summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-10-19 17:23:02 +0000
committerPhilip Reames <listmail@philipreames.com>2019-10-19 17:23:02 +0000
commit1d509201e2d2e926654ef762524754311fafcd59 (patch)
tree5a8647a6ef0ad83d2da6030ad8a4dc3a9726b08f
parent10213b90730e2459e6cbbeeb5c7289b18c298382 (diff)
downloadbcm5719-llvm-1d509201e2d2e926654ef762524754311fafcd59.tar.gz
bcm5719-llvm-1d509201e2d2e926654ef762524754311fafcd59.zip
[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 llvm-svn: 375349
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp35
-rw-r--r--llvm/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll2
-rw-r--r--llvm/test/Analysis/ScalarEvolution/max-trip-count.ll2
-rw-r--r--llvm/test/Analysis/ScalarEvolution/sext-mul.ll4
-rw-r--r--llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll88
5 files changed, 82 insertions, 49 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 8d4c7c5a55f..4d3c78c816e 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -10338,10 +10338,43 @@ bool ScalarEvolution::isImpliedViaOperations(ICmpInst::Predicate Pred,
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);
diff --git a/llvm/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll b/llvm/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
index 1c72440a749..5260fe90e6b 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-trip-count-address-space.ll
@@ -65,4 +65,4 @@ for.end: ; preds = %for.cond.for.end_cr
; 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
diff --git a/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
index 53b882bdcbf..e3ba313a690 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-trip-count.ll
@@ -97,7 +97,7 @@ for.end: ; preds = %for.cond.for.end_cr
; 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
diff --git a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll
index 42810be6ed7..4a107498197 100644
--- a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll
+++ b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll
@@ -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: ; preds = %bb7, %bb3
; 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) {
diff --git a/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll b/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll
index 7637ae92116..fb8f59fe425 100644
--- a/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll
+++ b/llvm/test/Analysis/ScalarEvolution/umin-umax-folds.ll
@@ -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
;
OpenPOWER on IntegriCloud