[llvm] [LV][EpilogueTF] Exclude loops with recurrences, alias-masking or unmaskable IAI (PR #224835)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 06:39:49 PDT 2026


================
@@ -120,6 +127,49 @@ for.end:
   ret i32 0
 }
 
+define i64 @find_last_offset_wide_canonical_iv(ptr %A, i64 %n) {
+; CHECK-LABEL: Checking a loop in 'find_last_offset_wide_canonical_iv'
+; CHECK: remark: <unknown>:0:0: Epilogue tail-folding is not supported with reductions
+;
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %red = phi i64 [ -1, %entry ], [ %sel, %loop ]
+  %gep = getelementptr inbounds i32, ptr %A, i64 %iv
+  %l = load i32, ptr %gep, align 4
+  %c = icmp eq i32 %l, 11
+  %sel = select i1 %c, i64 %iv, i64 %red
+  %iv.next = add nuw nsw i64 %iv, 1
+  %ec = icmp eq i64 %iv.next, %n
+  br i1 %ec, label %exit, label %loop
+
+exit:
+  ret i64 %sel
+}
+
+define i32 @fixed-order-recurrence(ptr %src) {
+; CHECK-LABEL: Checking a loop in 'fixed-order-recurrence'
+; CHECK: remark: <unknown>:0:0: Epilogue tail-folding is not supported with fixed-order recurrence
+;
+entry:
+  br label %for.body
+
+for.body:
----------------
david-arm wrote:

nit: Can you use a consistent naming scheme throughout the tests for things like the induction variables and loop block names?

For example, it would be good to use `%iv`, `%iv.next` for the induction variable and increment, respectively, similar to `@find_last_offset_wide_canonical_iv`. Also the block can be called `loop:`. Same for the test `@test_no_masked_interleave_support` below.

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


More information about the llvm-commits mailing list