llvm.org GIT mirror llvm / c624032
[SCEV] Simplify umin/max of zext and sext of the same value This is a common idiom which arises after induction variables are widened, and we have two or more exit conditions. Interestingly, we don't have instcombine or instsimplify support for this either. Differential Revision: https://reviews.llvm.org/D69006 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375349 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 1 year, 3 days ago
5 changed file(s) with 97 addition(s) and 64 deletion(s). Raw diff Collapse all Expand all
1033710337 return false;
1033810338 }
1033910339
10340 static bool isKnownPredicateExtendIdiom(ICmpInst::Predicate Pred,
10341 const SCEV *LHS, const SCEV *RHS) {
10342 // zext x u<= sext x, sext x s<= zext x
10343 switch (Pred) {
10344 case ICmpInst::ICMP_SGE:
10345 std::swap(LHS, RHS);
10346 LLVM_FALLTHROUGH;
10347 case ICmpInst::ICMP_SLE: {
10348 // If operand >=s 0 then ZExt == SExt. If operand
10349 const SCEVSignExtendExpr *SExt = dyn_cast(LHS);
10350 const SCEVZeroExtendExpr *ZExt = dyn_cast(RHS);
10351 if (SExt && ZExt && SExt->getOperand() == ZExt->getOperand())
10352 return true;
10353 break;
10354 }
10355 case ICmpInst::ICMP_UGE:
10356 std::swap(LHS, RHS);
10357 LLVM_FALLTHROUGH;
10358 case ICmpInst::ICMP_ULE: {
10359 // If operand >=s 0 then ZExt == SExt. If operand
10360 const SCEVZeroExtendExpr *ZExt = dyn_cast(LHS);
10361 const SCEVSignExtendExpr *SExt = dyn_cast(RHS);
10362 if (SExt && ZExt && SExt->getOperand() == ZExt->getOperand())
10363 return true;
10364 break;
10365 }
10366 default:
10367 break;
10368 };
10369 return false;
10370 }
10371
1034010372 bool
1034110373 ScalarEvolution::isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred,
1034210374 const SCEV *LHS, const SCEV *RHS) {
10343 return isKnownPredicateViaConstantRanges(Pred, LHS, RHS) ||
10375 return isKnownPredicateExtendIdiom(Pred, LHS, RHS) ||
10376 isKnownPredicateViaConstantRanges(Pred, LHS, RHS) ||
1034410377 IsKnownPredicateViaMinOrMax(*this, Pred, LHS, RHS) ||
1034510378 IsKnownPredicateViaAddRecStart(*this, Pred, LHS, RHS) ||
1034610379 isKnownPredicateViaNoOverflow(Pred, LHS, RHS);
6464
6565 ; CHECK: Determining loop execution counts for: @test
6666 ; CHECK-NEXT: backedge-taken count is
67 ; CHECK-NEXT: max backedge-taken count is -1
67 ; CHECK-NEXT: max backedge-taken count is 4294967294
9696
9797 ; CHECK: Determining loop execution counts for: @test
9898 ; CHECK-NEXT: backedge-taken count is
99 ; CHECK-NEXT: max backedge-taken count is -1
99 ; CHECK-NEXT: max backedge-taken count is 4294967294
100100
101101 ; PR19799: Indvars miscompile due to an incorrect max backedge taken count from SCEV.
102102 ; CHECK-LABEL: @pr19799
1010 ; CHECK: %tmp15 = getelementptr inbounds i32, i32* %arg, i64 %tmp14
1111 ; CHECK-NEXT: --> {{.*}} Exits: (4 + (4 * (sext i32 (-2 + (2 * %arg2)) to i64)) + %arg)
1212 ; CHECK:Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg2 to i64))
13 ; CHECK-NEXT:Loop %bb7: max backedge-taken count is -1
13 ; CHECK-NEXT:Loop %bb7: max backedge-taken count is 4294967294
1414 ; CHECK-NEXT:Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg2 to i64))
1515
1616 define void @foo(i32* nocapture %arg, i32 %arg1, i32 %arg2) {
5151 ; CHECK: %t14 = or i128 %t10, 1
5252 ; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128))
5353 ; CHECK: Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg5 to i128))
54 ; CHECK-NEXT: Loop %bb7: max backedge-taken count is -1
54 ; CHECK-NEXT: Loop %bb7: max backedge-taken count is 4294967294
5555 ; CHECK-NEXT: Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg5 to i128))
5656
5757 define void @goo(i32* nocapture %arg3, i32 %arg4, i32 %arg5) {
88 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
99 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
1010 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
11 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
12 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
13 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
11 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
12 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
13 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
1414 ; CHECK-NEXT: %and = and i1 %cmp1, %cmp2
1515 ; CHECK-NEXT: --> %and U: full-set S: full-set Exits: <> LoopDispositions: { %loop: Variant }
1616 ; CHECK-NEXT: Determining loop execution counts for: @umin_sext_x_zext_x
17 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
18 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
19 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
17 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
18 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
19 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
2020 ; CHECK-NEXT: Predicates:
2121 ; CHECK: Loop %loop: Trip multiple is 1
2222 ;
4343 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
4444 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
4545 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
46 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
47 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
48 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
46 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
47 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
48 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
4949 ; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
50 ; CHECK-NEXT: --> ((zext i32 %len to i64) umin (sext i32 %len to i64)) U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
50 ; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
5151 ; CHECK-NEXT: Determining loop execution counts for: @ule_sext_x_zext_x
52 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
53 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
54 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
52 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
53 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
54 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
5555 ; CHECK-NEXT: Predicates:
5656 ; CHECK: Loop %loop: Trip multiple is 1
5757 ;
7878 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
7979 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
8080 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
81 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((zext i32 %len to i64) umax (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
82 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
83 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((zext i32 %len to i64) umax (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
81 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
82 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
83 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
8484 ; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
85 ; CHECK-NEXT: --> ((zext i32 %len to i64) umax (sext i32 %len to i64)) U: full-set S: full-set Exits: ((zext i32 %len to i64) umax (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
85 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
8686 ; CHECK-NEXT: Determining loop execution counts for: @uge_sext_x_zext_x
87 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
87 ; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
8888 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
89 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
89 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
9090 ; CHECK-NEXT: Predicates:
9191 ; CHECK: Loop %loop: Trip multiple is 1
9292 ;
113113 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
114114 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
115115 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
116 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
117 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
118 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
116 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
117 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
118 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
119119 ; CHECK-NEXT: %umin = select i1 %cmp1, i64 %len.zext, i64 %len.sext
120 ; CHECK-NEXT: --> ((zext i32 %len to i64) umin (sext i32 %len to i64)) U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
120 ; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
121121 ; CHECK-NEXT: Determining loop execution counts for: @ult_sext_x_zext_x
122 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
123 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
124 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
122 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
123 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
124 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
125125 ; CHECK-NEXT: Predicates:
126126 ; CHECK: Loop %loop: Trip multiple is 1
127127 ;
148148 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
149149 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
150150 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
151 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((zext i32 %len to i64) umax (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
152 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
153 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((zext i32 %len to i64) umax (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
151 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
152 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
153 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
154154 ; CHECK-NEXT: %umax = select i1 %cmp1, i64 %len.zext, i64 %len.sext
155 ; CHECK-NEXT: --> ((zext i32 %len to i64) umax (sext i32 %len to i64)) U: full-set S: full-set Exits: ((zext i32 %len to i64) umax (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
155 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
156156 ; CHECK-NEXT: Determining loop execution counts for: @ugt_sext_x_zext_x
157 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
157 ; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
158158 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
159 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
159 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
160160 ; CHECK-NEXT: Predicates:
161161 ; CHECK: Loop %loop: Trip multiple is 1
162162 ;
183183 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
184184 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
185185 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
186 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
187 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
188 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
186 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
187 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
188 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
189189 ; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
190 ; CHECK-NEXT: --> ((zext i32 %len to i64) umin (sext i32 %len to i64)) U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) umin (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
190 ; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
191191 ; CHECK-NEXT: Determining loop execution counts for: @sle_sext_x_zext_x
192 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
193 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
194 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
192 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
193 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
194 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
195195 ; CHECK-NEXT: Predicates:
196196 ; CHECK: Loop %loop: Trip multiple is 1
197197 ;
218218 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
219219 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
220220 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
221 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) smax (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
222 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
223 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) smax (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
221 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
222 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
223 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
224224 ; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
225 ; CHECK-NEXT: --> ((zext i32 %len to i64) smax (sext i32 %len to i64)) U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) smax (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
225 ; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
226226 ; CHECK-NEXT: Determining loop execution counts for: @sge_sext_x_zext_x
227 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
228 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
229 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
227 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
228 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
229 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
230230 ; CHECK-NEXT: Predicates:
231231 ; CHECK: Loop %loop: Trip multiple is 1
232232 ;
253253 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
254254 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
255255 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
256 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: ((zext i32 %len to i64) smin (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
257 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
258 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((zext i32 %len to i64) smin (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
256 ; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
257 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
258 ; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
259259 ; CHECK-NEXT: %umin = select i1 %cmp1, i64 %len.zext, i64 %len.sext
260 ; CHECK-NEXT: --> ((zext i32 %len to i64) smin (sext i32 %len to i64)) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: ((zext i32 %len to i64) smin (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
260 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
261261 ; CHECK-NEXT: Determining loop execution counts for: @slt_sext_x_zext_x
262 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smin (sext i32 %len to i64))
262 ; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
263263 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
264 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smin (sext i32 %len to i64))
264 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
265265 ; CHECK-NEXT: Predicates:
266266 ; CHECK: Loop %loop: Trip multiple is 1
267267 ;
288288 ; CHECK-NEXT: %len.sext = sext i32 %len to i64
289289 ; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
290290 ; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
291 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) smax (sext i32 %len to i64)) LoopDispositions: { %loop: Computable }
292 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
293 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) smax (sext i32 %len to i64))) LoopDispositions: { %loop: Computable }
291 ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
292 ; CHECK-NEXT: %iv.next = add i64 %iv, 1
293 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64)) LoopDispositions: { %loop: Computable }
294294 ; CHECK-NEXT: %umax = select i1 %cmp1, i64 %len.zext, i64 %len.sext
295 ; CHECK-NEXT: --> ((zext i32 %len to i64) smax (sext i32 %len to i64)) U: [0,4294967296) S: [0,4294967296) Exits: ((zext i32 %len to i64) smax (sext i32 %len to i64)) LoopDispositions: { %loop: Invariant }
295 ; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
296296 ; CHECK-NEXT: Determining loop execution counts for: @sgt_sext_x_zext_x
297 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
298 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
299 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
297 ; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
298 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
299 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
300300 ; CHECK-NEXT: Predicates:
301301 ; CHECK: Loop %loop: Trip multiple is 1
302302 ;