[llvm] f34742d - [NFC][SCEV] Add test with umin_seq w/ 1op and constant

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 06:07:57 PST 2022


Author: Roman Lebedev
Date: 2022-01-14T17:07:48+03:00
New Revision: f34742d7c1e726ad1e9d2dd1685aa0242d9da7f1

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

LOG: [NFC][SCEV] Add test with umin_seq w/ 1op and constant

Added: 
    

Modified: 
    llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll b/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
index fd75fa31218d..2e4bb76ef482 100644
--- a/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
+++ b/llvm/test/Analysis/ScalarEvolution/exit-count-select-safe.ll
@@ -410,6 +410,38 @@ exit:
   ret i32 %i
 }
 
+define i32 @logical_and_2ops_and_constant(i32 %n, i32 %m, i32 %k) {
+; CHECK-LABEL: 'logical_and_2ops_and_constant'
+; CHECK-NEXT:  Classifying expressions for: @logical_and_2ops_and_constant
+; CHECK-NEXT:    %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
+; CHECK-NEXT:    --> {0,+,1}<%loop> U: [0,43) S: [0,43) Exits: (%n umin_seq 42) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %i.next = add i32 %i, 1
+; CHECK-NEXT:    --> {1,+,1}<%loop> U: [1,44) S: [1,44) Exits: (1 + (%n umin_seq 42))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:    %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
+; CHECK-NEXT:    --> (42 umin %n) U: [0,43) S: [0,43) Exits: (42 umin %n) LoopDispositions: { %loop: Invariant }
+; CHECK-NEXT:    %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
+; CHECK-NEXT:    --> %cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
+; CHECK-NEXT:  Determining loop execution counts for: @logical_and_2ops_and_constant
+; CHECK-NEXT:  Loop %loop: backedge-taken count is (%n umin_seq 42)
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 42
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is (%n umin_seq 42)
+; CHECK-NEXT:   Predicates:
+; CHECK:       Loop %loop: Trip multiple is 1
+;
+entry:
+  br label %loop
+loop:
+  %i = phi i32 [0, %entry], [%i.next, %loop]
+  %i.next = add i32 %i, 1
+  %umin = call i32 @llvm.umin.i32(i32 %n, i32 42)
+  %cond_p0 = icmp uge i32 %i, %umin
+  %cond_p1 = icmp uge i32 %i, %n
+  %cond = select i1 %cond_p1, i1 true, i1 %cond_p0
+  br i1 %cond, label %exit, label %loop
+exit:
+  ret i32 %i
+}
+
 define i32 @computeSCEVAtScope(i32 %d.0) {
 ; CHECK-LABEL: 'computeSCEVAtScope'
 ; CHECK-NEXT:  Classifying expressions for: @computeSCEVAtScope


        


More information about the llvm-commits mailing list