[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 10:01:30 PDT 2023


================
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available:
 
   }];
 }
+
+def CodeAlignAttrDocs : Documentation {
+  let Category = DocCatVariable;
+  let Heading = "clang::code_align";
+  let Content = [{
+The ``clang::code_align(N)`` attribute applies to a loop and it specifies the
+byte alignment for a loop. The attribute accepts a positive integer constant
+initialization expression indicating the number of bytes for the minimum
+alignment boundary. Its value must be a power of 2, between 1 and 4096, such as
+1, 2, 4, 8, and so on. This attribute sets ``llvm.loop.align`` loop metadata
+when it applies on a loop statement.
----------------
AaronBallman wrote:

Users shouldn't really be caring about what LLVM IR metadata we generate; this should be more focused on what the impact is to the user's code.

That said, I don't see any documentation for `llvm.loop.align` at https://llvm.org/docs/LangRef.html#llvm-loop nor do I see any test coverage for it in-tree. Are you sure LLVM has this IR already, or is that being added in a separate patch?

https://github.com/llvm/llvm-project/pull/70762


More information about the cfe-commits mailing list