From 4a5edea1930ddbcd3af46827f6cc976cc1b30e2a Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 19 Feb 2021 08:27:46 -0800 Subject: [PATCH] [SCEV] Use both known bits and sign bits when computing range of SCEV unknowns When computing a range for a SCEVUnknown, today we use computeKnownBits for unsigned ranges, and computeNumSignBots for signed ranges. This means we miss opportunities to improve range results. One common missed pattern is that we have a signed range of a value which CKB can determine is positive, but CNSB doesn't convey that information. The current range includes the negative part, and is thus double the size. Per the removed comment, the original concern which delayed using both (after some code merging years back) was a compile time concern. CTMark results (provided by Nikita, thanks!) showed a geomean impact of about 0.1%. This doesn't seem large enough to avoid higher quality results. Differential Revision: https://reviews.llvm.org/D96534 --- llvm/lib/Analysis/ScalarEvolution.cpp | 59 ++++++++++------------ .../add-expr-pointer-operand-sorting.ll | 2 +- llvm/test/Analysis/ScalarEvolution/ashr.ll | 2 +- .../extract-highbits-sameconstmask.ll | 2 +- .../ScalarEvolution/increasing-or-decreasing-iv.ll | 36 ++++++------- .../ScalarEvolution/max-be-count-not-constant.ll | 10 ++-- .../ScalarEvolution/ptrtoint-constantexpr-loop.ll | 32 ++++++------ llvm/test/Analysis/ScalarEvolution/ptrtoint.ll | 4 +- llvm/test/Analysis/ScalarEvolution/ranges.ll | 2 +- llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll | 6 +-- llvm/test/Analysis/StackSafetyAnalysis/local.ll | 4 +- .../test/Analysis/StackSafetyAnalysis/memintrin.ll | 2 +- .../Transforms/PhaseOrdering/scev-custom-dl.ll | 2 +- 13 files changed, 79 insertions(+), 84 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index c6152f3..b8d55e6 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -5843,39 +5843,34 @@ ScalarEvolution::getRangeRef(const SCEV *S, ConservativeResult = ConservativeResult.intersectWith(MDRange.getValue(), RangeType); - // Split here to avoid paying the compile-time cost of calling both - // computeKnownBits and ComputeNumSignBits. This restriction can be lifted - // if needed. + // See if ValueTracking can give us a useful range. const DataLayout &DL = getDataLayout(); - if (SignHint == ScalarEvolution::HINT_RANGE_UNSIGNED) { - // For a SCEVUnknown, ask ValueTracking. - KnownBits Known = computeKnownBits(U->getValue(), DL, 0, &AC, nullptr, &DT); - if (Known.getBitWidth() != BitWidth) - Known = Known.zextOrTrunc(BitWidth); - // If Known does not result in full-set, intersect with it. - if (Known.getMinValue() != Known.getMaxValue() + 1) - ConservativeResult = ConservativeResult.intersectWith( - ConstantRange(Known.getMinValue(), Known.getMaxValue() + 1), - RangeType); - } else { - assert(SignHint == ScalarEvolution::HINT_RANGE_SIGNED && - "generalize as needed!"); - unsigned NS = ComputeNumSignBits(U->getValue(), DL, 0, &AC, nullptr, &DT); - // If the pointer size is larger than the index size type, this can cause - // NS to be larger than BitWidth. So compensate for this. - if (U->getType()->isPointerTy()) { - unsigned ptrSize = DL.getPointerTypeSizeInBits(U->getType()); - int ptrIdxDiff = ptrSize - BitWidth; - if (ptrIdxDiff > 0 && ptrSize > BitWidth && NS > (unsigned)ptrIdxDiff) - NS -= ptrIdxDiff; - } - - if (NS > 1) - ConservativeResult = ConservativeResult.intersectWith( - ConstantRange(APInt::getSignedMinValue(BitWidth).ashr(NS - 1), - APInt::getSignedMaxValue(BitWidth).ashr(NS - 1) + 1), - RangeType); - } + KnownBits Known = computeKnownBits(U->getValue(), DL, 0, &AC, nullptr, &DT); + if (Known.getBitWidth() != BitWidth) + Known = Known.zextOrTrunc(BitWidth); + // If Known does not result in full-set, intersect with it. + if (Known.getMinValue() != Known.getMaxValue() + 1) + ConservativeResult = ConservativeResult.intersectWith( + ConstantRange(Known.getMinValue(), Known.getMaxValue() + 1), + RangeType); + + // ValueTracking may be able to compute a tighter result for the number of + // sign bits than for the value of those sign bits. + unsigned NS = ComputeNumSignBits(U->getValue(), DL, 0, &AC, nullptr, &DT); + // If the pointer size is larger than the index size type, this can cause + // NS to be larger than BitWidth. So compensate for this. + if (U->getType()->isPointerTy()) { + unsigned ptrSize = DL.getPointerTypeSizeInBits(U->getType()); + int ptrIdxDiff = ptrSize - BitWidth; + if (ptrIdxDiff > 0 && ptrSize > BitWidth && NS > (unsigned)ptrIdxDiff) + NS -= ptrIdxDiff; + } + + if (NS > 1) + ConservativeResult = ConservativeResult.intersectWith( + ConstantRange(APInt::getSignedMinValue(BitWidth).ashr(NS - 1), + APInt::getSignedMaxValue(BitWidth).ashr(NS - 1) + 1), + RangeType); // A range of Phi is a subset of union of all ranges of its input. if (const PHINode *Phi = dyn_cast(U->getValue())) { diff --git a/llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll b/llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll index a8575c4..6c8db2a 100644 --- a/llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll +++ b/llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll @@ -37,7 +37,7 @@ define i32 @d(i32 %base) { ; CHECK-NEXT: %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, ptrtoint ([1 x i32]* @b to i64) ; CHECK-NEXT: --> ((-1 * (ptrtoint [1 x i32]* @b to i64)) + (ptrtoint i32* %1 to i64)) U: full-set S: full-set Exits: <> LoopDispositions: { %for.cond: Variant } ; CHECK-NEXT: %sub.ptr.div = sdiv exact i64 %sub.ptr.sub, 4 -; CHECK-NEXT: --> %sub.ptr.div U: full-set S: [-2305843009213693952,2305843009213693952) Exits: <> LoopDispositions: { %for.cond: Variant } +; CHECK-NEXT: --> %sub.ptr.div U: [-2305843009213693952,2305843009213693952) S: [-2305843009213693952,2305843009213693952) Exits: <> LoopDispositions: { %for.cond: Variant } ; CHECK-NEXT: %arrayidx1 = getelementptr inbounds [1 x i8], [1 x i8]* %arrayidx, i64 0, i64 %sub.ptr.div ; CHECK-NEXT: --> ({((sext i32 %base to i64) + %e),+,1}<%for.cond> + %sub.ptr.div) U: full-set S: full-set Exits: <> LoopDispositions: { %for.cond: Variant } ; CHECK-NEXT: %2 = load i8, i8* %arrayidx1, align 1 diff --git a/llvm/test/Analysis/ScalarEvolution/ashr.ll b/llvm/test/Analysis/ScalarEvolution/ashr.ll index 0d661c87..0da69e5 100644 --- a/llvm/test/Analysis/ScalarEvolution/ashr.ll +++ b/llvm/test/Analysis/ScalarEvolution/ashr.ll @@ -31,7 +31,7 @@ define i32 @t2(i32 %x, i32 %y) { ; CHECK-LABEL: 't2' ; CHECK-NEXT: Classifying expressions for: @t2 ; CHECK-NEXT: %i0 = ashr i32 %x, 4 -; CHECK-NEXT: --> %i0 U: full-set S: [-134217728,134217728) +; CHECK-NEXT: --> %i0 U: [-134217728,134217728) S: [-134217728,134217728) ; CHECK-NEXT: Determining loop execution counts for: @t2 ; %i0 = ashr i32 %x, 4 diff --git a/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll b/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll index 7dcf168..de870bb 100644 --- a/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll @@ -21,7 +21,7 @@ define i32 @sdiv(i32 %val) nounwind { ; CHECK-LABEL: 'sdiv' ; CHECK-NEXT: Classifying expressions for: @sdiv ; CHECK-NEXT: %tmp1 = sdiv i32 %val, 16 -; CHECK-NEXT: --> %tmp1 U: full-set S: [-134217728,134217728) +; CHECK-NEXT: --> %tmp1 U: [-134217728,134217728) S: [-134217728,134217728) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 16 ; CHECK-NEXT: --> (16 * %tmp1) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: Determining loop execution counts for: @sdiv diff --git a/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll b/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll index 8d98069..a2eb19b 100644 --- a/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll +++ b/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll @@ -6,7 +6,7 @@ define void @f0(i1 %c) { ; CHECK-LABEL: 'f0' ; CHECK-NEXT: Classifying expressions for: @f0 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -14,7 +14,7 @@ define void @f0(i1 %c) { ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ] ; CHECK-NEXT: --> {%start,+,%step}<%loop> U: [0,128) S: [0,128) Exits: ((127 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-384,256) S: [-384,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f0 @@ -45,7 +45,7 @@ define void @f1(i1 %c) { ; CHECK-LABEL: 'f1' ; CHECK-NEXT: Classifying expressions for: @f1 ; CHECK-NEXT: %start = select i1 %c, i32 120, i32 0 -; CHECK-NEXT: --> %start U: [0,121) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,121) S: [0,121) ; CHECK-NEXT: %step = select i1 %c, i32 -8, i32 8 ; CHECK-NEXT: --> %step U: [8,-7) S: [-16,16) ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -81,7 +81,7 @@ define void @f1(i1 %c) { ; CHECK-NEXT: %iv.m7 = sub i32 %iv, 7 ; CHECK-NEXT: --> {(-7 + %start),+,%step}<%loop> U: [-7,114) S: [-7,114) Exits: (-7 + (15 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [0,-7) S: [-384,368) Exits: ((16 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [0,-7) S: [-256,361) Exits: ((16 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,17) S: [1,17) Exits: 16 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f1 @@ -131,7 +131,7 @@ define void @f2(i1 %c) { ; CHECK-LABEL: 'f2' ; CHECK-NEXT: Classifying expressions for: @f2 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -139,9 +139,9 @@ define void @f2(i1 %c) { ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.next, %loop ] ; CHECK-NEXT: --> {%start,+,%step}<%loop> U: [0,128) S: [0,128) Exits: ((127 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.sext = sext i32 %iv to i64 -; CHECK-NEXT: --> {(sext i32 %start to i64),+,(sext i32 %step to i64)}<%loop> U: [0,128) S: [0,128) Exits: ((sext i32 %start to i64) + (127 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(zext i32 %start to i64),+,(sext i32 %step to i64)}<%loop> U: [0,128) S: [0,128) Exits: ((zext i32 %start to i64) + (127 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-384,256) S: [-384,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f2 @@ -173,9 +173,9 @@ define void @f3(i1 %c) { ; CHECK-LABEL: 'f3' ; CHECK-NEXT: Classifying expressions for: @f3 ; CHECK-NEXT: %start = select i1 %c, i16 1000, i16 0 -; CHECK-NEXT: --> %start U: [0,1001) S: [-1024,1024) +; CHECK-NEXT: --> %start U: [0,1001) S: [0,1001) ; CHECK-NEXT: %step = select i1 %c, i16 1, i16 509 -; CHECK-NEXT: --> %step U: [1,510) S: [-512,512) +; CHECK-NEXT: --> %step U: [1,510) S: [1,510) ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ] ; CHECK-NEXT: --> {0,+,1}<%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv = phi i16 [ %start, %entry ], [ %iv.next, %loop ] @@ -222,7 +222,7 @@ define void @f4(i1 %c) { ; CHECK-LABEL: 'f4' ; CHECK-NEXT: Classifying expressions for: @f4 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i32 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -232,7 +232,7 @@ define void @f4(i1 %c) { ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: full-set S: full-set Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-384,256) S: [-384,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i32 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f4 @@ -270,7 +270,7 @@ define void @f5(i1 %c) { ; CHECK-LABEL: 'f5' ; CHECK-NEXT: Classifying expressions for: @f5 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -280,7 +280,7 @@ define void @f5(i1 %c) { ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: [0,128) S: [0,128) Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-384,256) S: [-384,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f5 @@ -313,7 +313,7 @@ define void @f6(i1 %c) { ; CHECK-LABEL: 'f6' ; CHECK-NEXT: Classifying expressions for: @f6 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -2, i32 0 ; CHECK-NEXT: --> %step U: [0,-1) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -323,9 +323,9 @@ define void @f6(i1 %c) { ; CHECK-NEXT: %step.plus.one = add i32 %step, 1 ; CHECK-NEXT: --> (1 + %step) U: [1,0) S: [-1,3) Exits: (1 + %step) LoopDispositions: { %loop: Invariant } ; CHECK-NEXT: %iv.next = add i32 %iv, %step.plus.one -; CHECK-NEXT: --> {(1 + %step + %start),+,(1 + %step)}<%loop> U: [-256,384) S: [-256,384) Exits: (128 + (128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(1 + %step + %start),+,(1 + %step)}<%loop> U: [-128,384) S: [-128,384) Exits: (128 + (128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.sext = sext i32 %iv to i64 -; CHECK-NEXT: --> {(sext i32 %start to i64),+,(1 + (sext i32 %step to i64))}<%loop> U: [0,128) S: [0,128) Exits: (127 + (sext i32 %start to i64) + (127 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(zext i32 %start to i64),+,(1 + (sext i32 %step to i64))}<%loop> U: [0,128) S: [0,128) Exits: (127 + (zext i32 %start to i64) + (127 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %loop.iv.inc = add i16 %loop.iv, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,129) S: [1,129) Exits: 128 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f6 @@ -359,7 +359,7 @@ define void @f7(i1 %c) { ; CHECK-LABEL: 'f7' ; CHECK-NEXT: Classifying expressions for: @f7 ; CHECK-NEXT: %start = select i1 %c, i32 127, i32 0 -; CHECK-NEXT: --> %start U: [0,128) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,128) S: [0,128) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ] @@ -369,7 +369,7 @@ define void @f7(i1 %c) { ; CHECK-NEXT: %iv.trunc = trunc i32 %iv to i16 ; CHECK-NEXT: --> {(trunc i32 %start to i16),+,(trunc i32 %step to i16)}<%loop> U: [0,128) S: [0,128) Exits: ((trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.next = add i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-384,256) S: [-384,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-256,256) S: [-256,256) Exits: ((128 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.trunc.plus.one = add i16 %iv.trunc, 1 ; CHECK-NEXT: --> {(1 + (trunc i32 %start to i16)),+,(trunc i32 %step to i16)}<%loop> U: [1,129) S: [1,129) Exits: (1 + (trunc i32 %start to i16) + (127 * (trunc i32 %step to i16))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.trunc.plus.two = add i16 %iv.trunc, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll b/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll index 12bd0d9..96452d1 100644 --- a/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll +++ b/llvm/test/Analysis/ScalarEvolution/max-be-count-not-constant.ll @@ -13,16 +13,16 @@ define void @pluto(i32 %arg) { ; CHECK-LABEL: 'pluto' ; CHECK-NEXT: Classifying expressions for: @pluto ; CHECK-NEXT: %tmp = ashr i32 %arg, 31 -; CHECK-NEXT: --> %tmp U: full-set S: [-1,1) +; CHECK-NEXT: --> %tmp U: [-1,1) S: [-1,1) ; CHECK-NEXT: %tmp1 = add nsw i32 %tmp, 2 -; CHECK-NEXT: --> (2 + %tmp) U: [-2147483646,-2147483648) S: [1,3) +; CHECK-NEXT: --> (2 + %tmp) U: [1,3) S: [1,3) ; CHECK-NEXT: %tmp3 = phi i32 [ 0, %bb ], [ %tmp4, %bb2 ] -; CHECK-NEXT: --> {0,+,(2 + %tmp)}<%bb2> U: [0,5) S: [0,5) Exits: ((2 + %tmp) * (1 /u (2 + %tmp))) LoopDispositions: { %bb2: Computable } +; CHECK-NEXT: --> {0,+,(2 + %tmp)}<%bb2> U: [0,3) S: [0,3) Exits: ((2 + %tmp) * (1 /u (2 + %tmp))) LoopDispositions: { %bb2: Computable } ; CHECK-NEXT: %tmp4 = add nuw nsw i32 %tmp1, %tmp3 -; CHECK-NEXT: --> {(2 + %tmp),+,(2 + %tmp)}<%bb2> U: [1,7) S: [1,7) Exits: (2 + ((2 + %tmp) * (1 /u (2 + %tmp))) + %tmp) LoopDispositions: { %bb2: Computable } +; CHECK-NEXT: --> {(2 + %tmp),+,(2 + %tmp)}<%bb2> U: [1,5) S: [1,5) Exits: (2 + ((2 + %tmp) * (1 /u (2 + %tmp))) + %tmp) LoopDispositions: { %bb2: Computable } ; CHECK-NEXT: Determining loop execution counts for: @pluto ; CHECK-NEXT: Loop %bb2: backedge-taken count is (1 /u (2 + %tmp)) -; CHECK-NEXT: Loop %bb2: max backedge-taken count is 2 +; CHECK-NEXT: Loop %bb2: max backedge-taken count is 1 ; CHECK-NEXT: Loop %bb2: Predicated backedge-taken count is (1 /u (2 + %tmp)) ; CHECK-NEXT: Predicates: ; CHECK: Loop %bb2: Trip multiple is 1 diff --git a/llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll b/llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll index 1429f60..5e1d831 100644 --- a/llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll +++ b/llvm/test/Analysis/ScalarEvolution/ptrtoint-constantexpr-loop.ll @@ -69,9 +69,9 @@ define hidden i32* @trunc_ptr_to_i64(i8* %arg, i32* %arg10) { ; PTR16_IDX32-NEXT: %tmp = phi i32 [ 0, %bb ], [ %tmp18, %bb17 ] ; PTR16_IDX32-NEXT: --> {0,+,2}<%bb11> U: [0,-1) S: [-2147483648,2147483647) Exits: <> LoopDispositions: { %bb11: Computable } ; PTR16_IDX32-NEXT: %tmp12 = getelementptr i8, i8* %arg, i64 ptrtoint ([0 x i8]* @global to i64) -; PTR16_IDX32-NEXT: --> ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) U: [0,131071) S: full-set Exits: ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) U: [0,131071) S: [0,131071) Exits: ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp13 = bitcast i8* %tmp12 to i32* -; PTR16_IDX32-NEXT: --> ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) U: [0,131071) S: full-set Exits: ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) U: [0,131071) S: [0,131071) Exits: ((trunc i64 ptrtoint ([0 x i8]* @global to i64) to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp14 = load i32, i32* %tmp13, align 4 ; PTR16_IDX32-NEXT: --> %tmp14 U: full-set S: full-set Exits: <> LoopDispositions: { %bb11: Variant } ; PTR16_IDX32-NEXT: %tmp18 = add i32 %tmp, 2 @@ -156,9 +156,9 @@ define hidden i32* @trunc_ptr_to_i32(i8* %arg, i32* %arg10) { ; PTR16_IDX32-NEXT: %tmp = phi i32 [ 0, %bb ], [ %tmp18, %bb17 ] ; PTR16_IDX32-NEXT: --> {0,+,2}<%bb11> U: [0,-1) S: [-2147483648,2147483647) Exits: <> LoopDispositions: { %bb11: Computable } ; PTR16_IDX32-NEXT: %tmp12 = getelementptr i8, i8* %arg, i32 ptrtoint ([0 x i8]* @global to i32) -; PTR16_IDX32-NEXT: --> (ptrtoint ([0 x i8]* @global to i32) + %arg) U: [0,131071) S: full-set Exits: (ptrtoint ([0 x i8]* @global to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> (ptrtoint ([0 x i8]* @global to i32) + %arg) U: [0,131071) S: [0,131071) Exits: (ptrtoint ([0 x i8]* @global to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp13 = bitcast i8* %tmp12 to i32* -; PTR16_IDX32-NEXT: --> (ptrtoint ([0 x i8]* @global to i32) + %arg) U: [0,131071) S: full-set Exits: (ptrtoint ([0 x i8]* @global to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> (ptrtoint ([0 x i8]* @global to i32) + %arg) U: [0,131071) S: [0,131071) Exits: (ptrtoint ([0 x i8]* @global to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp14 = load i32, i32* %tmp13, align 4 ; PTR16_IDX32-NEXT: --> %tmp14 U: full-set S: full-set Exits: <> LoopDispositions: { %bb11: Variant } ; PTR16_IDX32-NEXT: %tmp18 = add i32 %tmp, 2 @@ -243,9 +243,9 @@ define hidden i32* @trunc_ptr_to_i128(i8* %arg, i32* %arg10) { ; PTR16_IDX32-NEXT: %tmp = phi i32 [ 0, %bb ], [ %tmp18, %bb17 ] ; PTR16_IDX32-NEXT: --> {0,+,2}<%bb11> U: [0,-1) S: [-2147483648,2147483647) Exits: <> LoopDispositions: { %bb11: Computable } ; PTR16_IDX32-NEXT: %tmp12 = getelementptr i8, i8* %arg, i128 ptrtoint ([0 x i8]* @global to i128) -; PTR16_IDX32-NEXT: --> ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) U: [0,131071) S: full-set Exits: ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) U: [0,131071) S: [0,131071) Exits: ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp13 = bitcast i8* %tmp12 to i32* -; PTR16_IDX32-NEXT: --> ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) U: [0,131071) S: full-set Exits: ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) LoopDispositions: { %bb11: Invariant } +; PTR16_IDX32-NEXT: --> ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) U: [0,131071) S: [0,131071) Exits: ((trunc i128 ptrtoint ([0 x i8]* @global to i128) to i32) + %arg) LoopDispositions: { %bb11: Invariant } ; PTR16_IDX32-NEXT: %tmp14 = load i32, i32* %tmp13, align 4 ; PTR16_IDX32-NEXT: --> %tmp14 U: full-set S: full-set Exits: <> LoopDispositions: { %bb11: Variant } ; PTR16_IDX32-NEXT: %tmp18 = add i32 %tmp, 2 @@ -280,7 +280,7 @@ define void @zext_ptr_to_i32(i32 %arg, i32 %arg6) { ; PTR64_IDX64-NEXT: %tmp = sub i32 %arg, ptrtoint ([0 x i8]* @global to i32) ; PTR64_IDX64-NEXT: --> ((-1 * (trunc i64 (ptrtoint [0 x i8]* @global to i64) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (trunc i64 (ptrtoint [0 x i8]* @global to i64) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR64_IDX64-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR64_IDX64-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR64_IDX64-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR64_IDX64-NEXT: Determining loop execution counts for: @zext_ptr_to_i32 ; PTR64_IDX64-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR64_IDX64-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -291,7 +291,7 @@ define void @zext_ptr_to_i32(i32 %arg, i32 %arg6) { ; PTR64_IDX32-NEXT: %tmp = sub i32 %arg, ptrtoint ([0 x i8]* @global to i32) ; PTR64_IDX32-NEXT: --> ((-1 * ptrtoint ([0 x i8]* @global to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * ptrtoint ([0 x i8]* @global to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR64_IDX32-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR64_IDX32-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR64_IDX32-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR64_IDX32-NEXT: Determining loop execution counts for: @zext_ptr_to_i32 ; PTR64_IDX32-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR64_IDX32-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -302,7 +302,7 @@ define void @zext_ptr_to_i32(i32 %arg, i32 %arg6) { ; PTR16_IDX16-NEXT: %tmp = sub i32 %arg, ptrtoint ([0 x i8]* @global to i32) ; PTR16_IDX16-NEXT: --> ((-1 * (zext i16 (ptrtoint [0 x i8]* @global to i16) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (zext i16 (ptrtoint [0 x i8]* @global to i16) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR16_IDX16-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR16_IDX16-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR16_IDX16-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR16_IDX16-NEXT: Determining loop execution counts for: @zext_ptr_to_i32 ; PTR16_IDX16-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR16_IDX16-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -313,7 +313,7 @@ define void @zext_ptr_to_i32(i32 %arg, i32 %arg6) { ; PTR16_IDX32-NEXT: %tmp = sub i32 %arg, ptrtoint ([0 x i8]* @global to i32) ; PTR16_IDX32-NEXT: --> ((-1 * ptrtoint ([0 x i8]* @global to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * ptrtoint ([0 x i8]* @global to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR16_IDX32-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR16_IDX32-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR16_IDX32-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR16_IDX32-NEXT: Determining loop execution counts for: @zext_ptr_to_i32 ; PTR16_IDX32-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR16_IDX32-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -339,7 +339,7 @@ define void @sext_to_i32(i32 %arg, i32 %arg6) { ; PTR64_IDX64-NEXT: %tmp = sub i32 %arg, sext (i16 ptrtoint ([0 x i8]* @global to i16) to i32) ; PTR64_IDX64-NEXT: --> ((-1 * (sext i16 (trunc i64 (ptrtoint [0 x i8]* @global to i64) to i16) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (sext i16 (trunc i64 (ptrtoint [0 x i8]* @global to i64) to i16) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR64_IDX64-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR64_IDX64-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR64_IDX64-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR64_IDX64-NEXT: Determining loop execution counts for: @sext_to_i32 ; PTR64_IDX64-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR64_IDX64-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -350,7 +350,7 @@ define void @sext_to_i32(i32 %arg, i32 %arg6) { ; PTR64_IDX32-NEXT: %tmp = sub i32 %arg, sext (i16 ptrtoint ([0 x i8]* @global to i16) to i32) ; PTR64_IDX32-NEXT: --> ((-1 * (sext i16 ptrtoint ([0 x i8]* @global to i16) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (sext i16 ptrtoint ([0 x i8]* @global to i16) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR64_IDX32-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR64_IDX32-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR64_IDX32-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR64_IDX32-NEXT: Determining loop execution counts for: @sext_to_i32 ; PTR64_IDX32-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR64_IDX32-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -361,7 +361,7 @@ define void @sext_to_i32(i32 %arg, i32 %arg6) { ; PTR16_IDX16-NEXT: %tmp = sub i32 %arg, sext (i16 ptrtoint ([0 x i8]* @global to i16) to i32) ; PTR16_IDX16-NEXT: --> ((-1 * (sext i16 (ptrtoint [0 x i8]* @global to i16) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (sext i16 (ptrtoint [0 x i8]* @global to i16) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR16_IDX16-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR16_IDX16-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR16_IDX16-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR16_IDX16-NEXT: Determining loop execution counts for: @sext_to_i32 ; PTR16_IDX16-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR16_IDX16-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -372,7 +372,7 @@ define void @sext_to_i32(i32 %arg, i32 %arg6) { ; PTR16_IDX32-NEXT: %tmp = sub i32 %arg, sext (i16 ptrtoint ([0 x i8]* @global to i16) to i32) ; PTR16_IDX32-NEXT: --> ((-1 * (sext i16 ptrtoint ([0 x i8]* @global to i16) to i32)) + %arg) U: full-set S: full-set Exits: ((-1 * (sext i16 ptrtoint ([0 x i8]* @global to i16) to i32)) + %arg) LoopDispositions: { %bb7: Invariant } ; PTR16_IDX32-NEXT: %tmp9 = select i1 %tmp8, i16 0, i16 1 -; PTR16_IDX32-NEXT: --> %tmp9 U: [0,2) S: [-2,2) Exits: <> LoopDispositions: { %bb7: Variant } +; PTR16_IDX32-NEXT: --> %tmp9 U: [0,2) S: [0,2) Exits: <> LoopDispositions: { %bb7: Variant } ; PTR16_IDX32-NEXT: Determining loop execution counts for: @sext_to_i32 ; PTR16_IDX32-NEXT: Loop %bb7: Unpredictable backedge-taken count. ; PTR16_IDX32-NEXT: Loop %bb7: Unpredictable max backedge-taken count. @@ -447,9 +447,9 @@ define i64 @sext_like_noop(i32 %n) { ; PTR16_IDX32-LABEL: 'sext_like_noop' ; PTR16_IDX32-NEXT: Classifying expressions for: @sext_like_noop ; PTR16_IDX32-NEXT: %ii = sext i32 %i to i64 -; PTR16_IDX32-NEXT: --> (sext i32 {1,+,1}<%for.body> to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) --> (-1 + (sext i32 ptrtoint (i64 (i32)* @sext_like_noop to i32) to i64)) U: [-1,65535) S: [-65537,65535) +; PTR16_IDX32-NEXT: --> (sext i32 {1,+,1}<%for.body> to i64) U: [-2147483648,2147483648) S: [-2147483648,2147483648) --> (-1 + (zext i32 ptrtoint (i64 (i32)* @sext_like_noop to i32) to i64)) U: [-1,65535) S: [-1,65535) ; PTR16_IDX32-NEXT: %div = sdiv i64 55555, %ii -; PTR16_IDX32-NEXT: --> %div U: full-set S: full-set --> sdiv (i64 55555, i64 add (i64 sext (i32 ptrtoint (i64 (i32)* @sext_like_noop to i32) to i64), i64 -1)) U: full-set S: full-set +; PTR16_IDX32-NEXT: --> %div U: full-set S: full-set --> sdiv (i64 55555, i64 add (i64 zext (i32 ptrtoint (i64 (i32)* @sext_like_noop to i32) to i64), i64 -1)) U: full-set S: full-set ; PTR16_IDX32-NEXT: %i = phi i32 [ %inc, %for.body ], [ 1, %entry ] ; PTR16_IDX32-NEXT: --> {1,+,1}<%for.body> U: [1,0) S: [1,0) Exits: (-1 + ptrtoint (i64 (i32)* @sext_like_noop to i32)) LoopDispositions: { %for.body: Computable } ; PTR16_IDX32-NEXT: %inc = add nuw i32 %i, 1 diff --git a/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll b/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll index 788a268..3c3da6c 100644 --- a/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll +++ b/llvm/test/Analysis/ScalarEvolution/ptrtoint.ll @@ -175,13 +175,13 @@ define void @ptrtoint_of_constantexpr_inttoptr(i64* %out0) { ; X64-LABEL: 'ptrtoint_of_constantexpr_inttoptr' ; X64-NEXT: Classifying expressions for: @ptrtoint_of_constantexpr_inttoptr ; X64-NEXT: %p0 = ptrtoint i8* inttoptr (i64 42 to i8*) to i64 -; X64-NEXT: --> (ptrtoint i8* inttoptr (i64 42 to i8*) to i64) U: [42,43) S: [-64,64) +; X64-NEXT: --> (ptrtoint i8* inttoptr (i64 42 to i8*) to i64) U: [42,43) S: [42,43) ; X64-NEXT: Determining loop execution counts for: @ptrtoint_of_constantexpr_inttoptr ; ; X32-LABEL: 'ptrtoint_of_constantexpr_inttoptr' ; X32-NEXT: Classifying expressions for: @ptrtoint_of_constantexpr_inttoptr ; X32-NEXT: %p0 = ptrtoint i8* inttoptr (i64 42 to i8*) to i64 -; X32-NEXT: --> (zext i32 (ptrtoint i8* inttoptr (i64 42 to i8*) to i32) to i64) U: [42,43) S: [0,4294967296) +; X32-NEXT: --> (zext i32 (ptrtoint i8* inttoptr (i64 42 to i8*) to i32) to i64) U: [42,43) S: [42,43) ; X32-NEXT: Determining loop execution counts for: @ptrtoint_of_constantexpr_inttoptr ; %p0 = ptrtoint i8* inttoptr (i64 42 to i8*) to i64 diff --git a/llvm/test/Analysis/ScalarEvolution/ranges.ll b/llvm/test/Analysis/ScalarEvolution/ranges.ll index 0868c10..d38e522 100644 --- a/llvm/test/Analysis/ScalarEvolution/ranges.ll +++ b/llvm/test/Analysis/ScalarEvolution/ranges.ll @@ -12,7 +12,7 @@ define i32 @ashr(i32 %a) { ; CHECK-LABEL: 'ashr' ; CHECK-NEXT: Classifying expressions for: @ashr ; CHECK-NEXT: %ashr = ashr i32 %a, 31 -; CHECK-NEXT: --> %ashr U: [0,1) S: [-1,1) +; CHECK-NEXT: --> %ashr U: [0,1) S: [0,1) ; CHECK-NEXT: Determining loop execution counts for: @ashr ; %pos = icmp sge i32 %a, 0 diff --git a/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll b/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll index 5bfb716..4a1beb2 100644 --- a/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll +++ b/llvm/test/Analysis/ScalarEvolution/sext-to-zext.ll @@ -6,7 +6,7 @@ define void @f(i1 %c) { ; CHECK-LABEL: 'f' ; CHECK-NEXT: Classifying expressions for: @f ; CHECK-NEXT: %start = select i1 %c, i32 100, i32 0 -; CHECK-NEXT: --> %start U: [0,101) S: [-128,128) +; CHECK-NEXT: --> %start U: [0,101) S: [0,101) ; CHECK-NEXT: %step = select i1 %c, i32 -1, i32 1 ; CHECK-NEXT: --> %step U: [1,0) S: [-2,2) ; CHECK-NEXT: %iv = phi i32 [ %start, %entry ], [ %iv.dec, %loop ] @@ -16,9 +16,9 @@ define void @f(i1 %c) { ; CHECK-NEXT: %iv.tc.inc = add i32 %iv.tc, 1 ; CHECK-NEXT: --> {1,+,1}<%loop> U: [1,101) S: [1,101) Exits: 100 LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.dec = add nsw i32 %iv, %step -; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-328,228) S: [-328,228) Exits: ((100 * %step) + %start) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(%step + %start),+,%step}<%loop> U: [-200,201) S: [-200,201) Exits: ((100 * %step) + %start) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: %iv.sext = sext i32 %iv to i64 -; CHECK-NEXT: --> {(sext i32 %start to i64),+,(sext i32 %step to i64)}<%loop> U: [0,101) S: [0,101) Exits: ((sext i32 %start to i64) + (99 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } +; CHECK-NEXT: --> {(zext i32 %start to i64),+,(sext i32 %step to i64)}<%loop> U: [0,101) S: [0,101) Exits: ((zext i32 %start to i64) + (99 * (sext i32 %step to i64))) LoopDispositions: { %loop: Computable } ; CHECK-NEXT: Determining loop execution counts for: @f ; CHECK-NEXT: Loop %loop: backedge-taken count is 99 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 99 diff --git a/llvm/test/Analysis/StackSafetyAnalysis/local.ll b/llvm/test/Analysis/StackSafetyAnalysis/local.ll index 1a14a0c..a1714bf 100644 --- a/llvm/test/Analysis/StackSafetyAnalysis/local.ll +++ b/llvm/test/Analysis/StackSafetyAnalysis/local.ll @@ -205,7 +205,7 @@ define void @NonConstantOffset(i1 zeroext %z) { ; CHECK-NEXT: args uses: ; CHECK-NEXT: allocas uses: ; FIXME: SCEV can't look through selects. -; CHECK-NEXT: x[4]: [-4,4){{$}} +; CHECK-NEXT: x[4]: [0,4){{$}} ; CHECK-EMPTY: entry: %x = alloca i32, align 4 @@ -246,7 +246,7 @@ define void @NonConstantOffsetOOB(i1 zeroext %z) { ; CHECK-LABEL: @NonConstantOffsetOOB dso_preemptable{{$}} ; CHECK-NEXT: args uses: ; CHECK-NEXT: allocas uses: -; CHECK-NEXT: x[4]: [-8,8){{$}} +; CHECK-NEXT: x[4]: [0,6){{$}} ; CHECK-EMPTY: entry: %x = alloca i32, align 4 diff --git a/llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll b/llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll index 8f1cc5f..5159c10 100644 --- a/llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll +++ b/llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll @@ -70,7 +70,7 @@ define void @MemsetNonConstInBounds(i1 zeroext %z) { ; CHECK-LABEL: MemsetNonConstInBounds dso_preemptable{{$}} ; CHECK-NEXT: args uses: ; CHECK-NEXT: allocas uses: -; CHECK-NEXT: x[4]: [0,4294967295){{$}} +; CHECK-NEXT: x[4]: [0,7){{$}} ; CHECK-EMPTY: entry: %x = alloca i32, align 4 diff --git a/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll b/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll index adbdfd9..78343128 100644 --- a/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll +++ b/llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll @@ -115,7 +115,7 @@ declare void @use(i1) declare void @llvm.experimental.guard(i1, ...) ; This tests getRangeRef acts as intended with different idx size. -; CHECK: max backedge-taken count is 318 +; CHECK: max backedge-taken count is 41 define void @test_range_ref1(i8 %t) { entry: %t.ptr = inttoptr i8 %t to i8* -- 2.7.4