[llvm] r375349 - [SCEV] Simplify umin/max of zext and sext of the same value
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 19 10:23:02 PDT 2019
Author: reames
Date: Sat Oct 19 10:23:02 2019
New Revision: 375349
URL: http://llvm.org/viewvc/llvm-project?rev=375349&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll
llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll
llvm/trunk/test/Analysis/ScalarEvolution/umin-umax-folds.ll
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=375349&r1=375348&r2=375349&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Oct 19 10:23:02 2019
@@ -10338,10 +10338,43 @@ bool ScalarEvolution::isImpliedViaOperat
return false;
}
+static bool isKnownPredicateExtendIdiom(ICmpInst::Predicate Pred,
+ const SCEV *LHS, const SCEV *RHS) {
+ // zext x u<= sext x, sext x s<= zext x
+ switch (Pred) {
+ case ICmpInst::ICMP_SGE:
+ std::swap(LHS, RHS);
+ LLVM_FALLTHROUGH;
+ case ICmpInst::ICMP_SLE: {
+ // If operand >=s 0 then ZExt == SExt. If operand <s 0 then SExt <s ZExt.
+ const SCEVSignExtendExpr *SExt = dyn_cast<SCEVSignExtendExpr>(LHS);
+ const SCEVZeroExtendExpr *ZExt = dyn_cast<SCEVZeroExtendExpr>(RHS);
+ if (SExt && ZExt && SExt->getOperand() == ZExt->getOperand())
+ return true;
+ break;
+ }
+ case ICmpInst::ICMP_UGE:
+ std::swap(LHS, RHS);
+ LLVM_FALLTHROUGH;
+ case ICmpInst::ICMP_ULE: {
+ // If operand >=s 0 then ZExt == SExt. If operand <s 0 then ZExt <u SExt.
+ const SCEVZeroExtendExpr *ZExt = dyn_cast<SCEVZeroExtendExpr>(LHS);
+ const SCEVSignExtendExpr *SExt = dyn_cast<SCEVSignExtendExpr>(RHS);
+ if (SExt && ZExt && SExt->getOperand() == ZExt->getOperand())
+ return true;
+ break;
+ }
+ default:
+ break;
+ };
+ return false;
+}
+
bool
ScalarEvolution::isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred,
const SCEV *LHS, const SCEV *RHS) {
- return isKnownPredicateViaConstantRanges(Pred, LHS, RHS) ||
+ return isKnownPredicateExtendIdiom(Pred, LHS, RHS) ||
+ isKnownPredicateViaConstantRanges(Pred, LHS, RHS) ||
IsKnownPredicateViaMinOrMax(*this, Pred, LHS, RHS) ||
IsKnownPredicateViaAddRecStart(*this, Pred, LHS, RHS) ||
isKnownPredicateViaNoOverflow(Pred, LHS, RHS);
Modified: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll?rev=375349&r1=375348&r2=375349&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll Sat Oct 19 10:23:02 2019
@@ -65,4 +65,4 @@ for.end:
; CHECK: Determining loop execution counts for: @test
; CHECK-NEXT: backedge-taken count is
-; CHECK-NEXT: max backedge-taken count is -1
+; CHECK-NEXT: max backedge-taken count is 4294967294
Modified: llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll?rev=375349&r1=375348&r2=375349&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/max-trip-count.ll Sat Oct 19 10:23:02 2019
@@ -97,7 +97,7 @@ for.end:
; CHECK: Determining loop execution counts for: @test
; CHECK-NEXT: backedge-taken count is
-; CHECK-NEXT: max backedge-taken count is -1
+; CHECK-NEXT: max backedge-taken count is 4294967294
; PR19799: Indvars miscompile due to an incorrect max backedge taken count from SCEV.
; CHECK-LABEL: @pr19799
Modified: llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll?rev=375349&r1=375348&r2=375349&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll Sat Oct 19 10:23:02 2019
@@ -11,7 +11,7 @@
; CHECK: %tmp15 = getelementptr inbounds i32, i32* %arg, i64 %tmp14
; CHECK-NEXT: --> {{.*}} Exits: (4 + (4 * (sext i32 (-2 + (2 * %arg2)) to i64))<nsw> + %arg)
; CHECK:Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg2 to i64))<nsw>
-; CHECK-NEXT:Loop %bb7: max backedge-taken count is -1
+; CHECK-NEXT:Loop %bb7: max backedge-taken count is 4294967294
; CHECK-NEXT:Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg2 to i64))<nsw>
define void @foo(i32* nocapture %arg, i32 %arg1, i32 %arg2) {
@@ -52,7 +52,7 @@ bb7:
; CHECK: %t14 = or i128 %t10, 1
; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128))<nuw><nsw>
; CHECK: Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg5 to i128))<nsw>
-; CHECK-NEXT: Loop %bb7: max backedge-taken count is -1
+; CHECK-NEXT: Loop %bb7: max backedge-taken count is 4294967294
; CHECK-NEXT: Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg5 to i128))<nsw>
define void @goo(i32* nocapture %arg3, i32 %arg4, i32 %arg5) {
Modified: llvm/trunk/test/Analysis/ScalarEvolution/umin-umax-folds.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/umin-umax-folds.ll?rev=375349&r1=375348&r2=375349&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/umin-umax-folds.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/umin-umax-folds.ll Sat Oct 19 10:23:02 2019
@@ -9,15 +9,15 @@ define void @umin_sext_x_zext_x(i32 %len
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %and = and i1 %cmp1, %cmp2
; CHECK-NEXT: --> %and U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
; CHECK-NEXT: Determining loop execution counts for: @umin_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -44,15 +44,15 @@ define void @ule_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @ule_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -79,15 +79,15 @@ define void @uge_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; 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 }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64))<nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @uge_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -114,15 +114,15 @@ define void @ult_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %umin = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @ult_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -149,15 +149,15 @@ define void @ugt_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; 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 }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64))<nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %umax = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @ugt_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -184,15 +184,15 @@ define void @sle_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) umin (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @sle_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) umin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -219,15 +219,15 @@ define void @sge_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) smax (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %sel = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @sge_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -254,15 +254,15 @@ define void @slt_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: full-set S: full-set Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + ((zext i32 %len to i64) smin (sext i32 %len to i64)))<nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: full-set S: full-set Exits: (1 + (sext i32 %len to i64))<nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %umin = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) Exits: (sext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @slt_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is -1
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smin (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (sext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -289,15 +289,15 @@ define void @sgt_sext_x_zext_x(i32 %len)
; CHECK-NEXT: %len.sext = sext i32 %len to i64
; CHECK-NEXT: --> (sext i32 %len to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648)
; CHECK-NEXT: %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
-; 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 }
+; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %iv.next = add i64 %iv, 1
-; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + ((zext i32 %len to i64) smax (sext i32 %len to i64)))<nuw><nsw> LoopDispositions: { %loop: Computable }
+; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,4294967297) S: [1,4294967297) Exits: (1 + (zext i32 %len to i64))<nuw><nsw> LoopDispositions: { %loop: Computable }
; CHECK-NEXT: %umax = select i1 %cmp1, i64 %len.zext, i64 %len.sext
-; 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 }
+; CHECK-NEXT: --> (zext i32 %len to i64) U: [0,4294967296) S: [0,4294967296) Exits: (zext i32 %len to i64) LoopDispositions: { %loop: Invariant }
; CHECK-NEXT: Determining loop execution counts for: @sgt_sext_x_zext_x
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4294967295
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((zext i32 %len to i64) smax (sext i32 %len to i64))
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (zext i32 %len to i64)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
More information about the llvm-commits
mailing list