[llvm] d48b249 - [SCEV] Add test cases where the max BTC is imprecise, due to step != 1.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 08:45:32 PDT 2020


Author: Florian Hahn
Date: 2020-10-10T16:39:48+01:00
New Revision: d48b249b71628f3a73540734f50c6aae21828566

URL: https://github.com/llvm/llvm-project/commit/d48b249b71628f3a73540734f50c6aae21828566
DIFF: https://github.com/llvm/llvm-project/commit/d48b249b71628f3a73540734f50c6aae21828566.diff

LOG: [SCEV] Add test cases where the max BTC is imprecise, due to step != 1.

Add a test case where we fail to compute a tight max backedge taken
count, due to the step being != 1.

This is part of the issue with PR40961.

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
index f961c83808a3..489ae76495b9 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
@@ -135,6 +135,28 @@ exit:
   ret void
 }
 
+define void @test_guard_ule_12_step2(i32* nocapture %a, i64 %N) {
+; CHECK-LABEL: Determining loop execution counts for: @test_guard_ule_12_step2
+; CHECK-NEXT:  Loop %loop: backedge-taken count is (%N /u 2)
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 9223372036854775807
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is (%N /u 2)
+;
+entry:
+  %c.1 = icmp ule i64 %N, 12
+  br i1 %c.1, label %loop, label %exit
+
+loop:
+  %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
+  %idx = getelementptr inbounds i32, i32* %a, i64 %iv
+  store i32 1, i32* %idx, align 4
+  %iv.next = add nuw nsw i64 %iv, 2
+  %exitcond = icmp eq i64 %iv, %N
+  br i1 %exitcond, label %exit, label %loop
+
+exit:
+  ret void
+}
+
 define void @test_multiple_const_guards_order1(i32* nocapture %a, i64 %i) {
 ; CHECK-LABEL: @test_multiple_const_guards_order1
 ; CHECK:       Loop %loop: backedge-taken count is %i


        


More information about the llvm-commits mailing list