[llvm] 1afdd36 - [SCEV] Add additional NE applyLoopGuards() test (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 24 12:46:54 PDT 2021


Author: Nikita Popov
Date: 2021-04-24T21:36:23+02:00
New Revision: 1afdd361a233c2ca2df0bac64ee71918e9705cd7

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

LOG: [SCEV] Add additional NE applyLoopGuards() test (NFC)

This is the same as @test_guard_ult_ne, just with the order of
the conditions swapped.

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 6920a894b741..4a176be0e9ed 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
@@ -447,6 +447,42 @@ exit:
   ret void
 }
 
+define void @test_guard_ne_ult(i32* nocapture readonly %data, i64 %count) {
+; CHECK-LABEL: 'test_guard_ne_ult'
+; CHECK-NEXT:  Classifying expressions for: @test_guard_ne_ult
+; CHECK-NEXT:    %iv = phi i64 [ %iv.next, %loop ], [ 0, %guardbb ]
+; CHECK-NEXT:    --> {0,+,1}<nuw><%loop> U: [0,-1) S: [0,-1) Exits: (-1 + %count) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %idx = getelementptr inbounds i32, i32* %data, i64 %iv
+; CHECK-NEXT:    --> {%data,+,4}<%loop> U: full-set S: full-set Exits: (-4 + (4 * %count) + %data) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %iv.next = add nuw i64 %iv, 1
+; CHECK-NEXT:    --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %count LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: @test_guard_ne_ult
+; CHECK-NEXT:  Loop %loop: backedge-taken count is (-1 + %count)
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is -2
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is (-1 + %count)
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 1
+;
+entry:
+  %cmp.ne = icmp ne i64 %count, 0
+  br i1 %cmp.ne, label %guardbb, label %exit
+
+guardbb:
+  %cmp.ult = icmp ult i64 %count, 5
+  br i1 %cmp.ult, label %loop, label %exit
+
+loop:
+  %iv = phi i64 [ %iv.next, %loop ], [ 0, %guardbb ]
+  %idx = getelementptr inbounds i32, i32* %data, i64 %iv
+  store i32 1, i32* %idx, align 4
+  %iv.next = add nuw i64 %iv, 1
+  %exitcond.not = icmp eq i64 %iv.next, %count
+  br i1 %exitcond.not, label %exit, label %loop
+
+exit:
+  ret void
+}
+
 ; Test case for PR47247. Both the guard condition and the assume limit the
 ; max backedge-taken count.
 


        


More information about the llvm-commits mailing list