================
@@ -1,28 +1,29 @@
-.. title:: clang-tidy - altera-id-dependent-backward-branch
+```{title} clang-tidy - altera-id-dependent-backward-branch
+```
 
-altera-id-dependent-backward-branch
-===================================
+# altera-id-dependent-backward-branch
 
 Finds ID-dependent variables and fields that are used within loops. This causes
 branches to occur inside the loops, and thus leads to performance degradation.
 
-.. code-block:: c++
+```cpp
+// The following code will produce a warning because this ID-dependent
+// variable is used in a loop condition statement.
+int ThreadID = get_local_id(0);
 
-  // The following code will produce a warning because this ID-dependent
-  // variable is used in a loop condition statement.
-  int ThreadID = get_local_id(0);
+// The following loop will produce a warning because the loop condition
+// statement depends on an ID-dependent variable.
+for (int i = 0; i < ThreadID; ++i) {
+  std::cout << i << std::endl;
+}
 
-  // The following loop will produce a warning because the loop condition
-  // statement depends on an ID-dependent variable.
-  for (int i = 0; i < ThreadID; ++i) {
-    std::cout << i << std::endl;
-  }
+// The following loop will not produce a warning, because the ID-dependent
+// variable is not used in the loop condition statement.
+for (int i = 0; i < 100; ++i) {
+  std::cout << ThreadID << std::endl;
+}
+```
 
-  // The following loop will not produce a warning, because the ID-dependent
-  // variable is not used in the loop condition statement.
-  for (int i = 0; i < 100; ++i) {
-    std::cout << ThreadID << std::endl;
-  }
+Based on the [Altera SDK for OpenCL: Best Practices Guide][altera-guide].
----------------
zeyi2 wrote:

Nit: Could we use an inline link here for consistency with 
`kernel-name-restriction.md`?

```
Based on the [Altera SDK for OpenCL: Best Practices 
Guide](https://www.altera.com/en_US/pdfs/literature/hb/opencl-sdk/aocl_optimization_guide.pdf).
```

That file already uses the inline-link form for a similar reference.

https://github.com/llvm/llvm-project/pull/210467
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to