[llvm] [CodeGen][MachineLoop] Fix getLoopID (PR #137820)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 01:35:01 PDT 2025


================
@@ -177,6 +177,48 @@ exit:                               ; preds = %bb2, %bb3, %bb4
   ret void
 }
 
+; test5 is to check if .p2align can be correctly set on loops with a single
+; latch that's not the exiting block.
+; The test IR is generated from below simple C file:
+; $ clang -O0 -S -emit-llvm loop.c
+; $ cat loop.c
+; int test5(int n) {
+;     int i = 0;
+;     [[clang::code_align(64)]]
+;     while (i < n) {
+;         i++;
+;     }
+; }
+; CHECK-LABEL: test5:
+; ALIGN: .p2align 6
+; ALIGN-NEXT: .LBB4_1: # %while.cond
+define dso_local i32 @test5(i32 %n) #0 {
----------------
arsenm wrote:

```suggestion
define i32 @test5(i32 %n) #0 {
```

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


More information about the llvm-commits mailing list