[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 {
+entry:
+ %retval = alloca i32, align 4
+ %n.addr = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 %n, ptr %n.addr, align 4
+ store i32 0, ptr %i, align 4
+ br label %while.cond
+
+while.cond: ; preds = %while.body, %entry
+ %0 = load i32, ptr %i, align 4
+ %1 = load i32, ptr %n.addr, align 4
+ %cmp = icmp slt i32 %0, %1
+ br i1 %cmp, label %while.body, label %while.end
+
+while.body: ; preds = %while.cond
+ %2 = load i32, ptr %i, align 4
----------------
arsenm wrote:
Use named values in tests
https://github.com/llvm/llvm-project/pull/137820
More information about the llvm-commits
mailing list