From 2ed501d6567180be986159fad6e5fd6431e8268d Mon Sep 17 00:00:00 2001 From: Tim Shen Date: Fri, 6 Jul 2018 23:20:35 +0000 Subject: [PATCH] Revert "[SCEV] Strengthen StrengthenNoWrapFlags (reapply r334428)." This reverts commit r336140. Our tests shows that LSR assert fails with it. llvm-svn: 336473 --- llvm/lib/Analysis/ScalarEvolution.cpp | 27 ++++++---------------- llvm/test/Analysis/Delinearization/a.ll | 2 +- .../iv_times_constant_in_subscript.ll | 2 +- llvm/test/Analysis/IVUsers/quadradic-exit-value.ll | 2 +- .../LoopAccessAnalysis/number-of-memchecks.ll | 4 ++-- .../wrapping-pointer-versioning.ll | 16 ++++++------- .../ScalarEvolution/different-loops-recs.ll | 2 +- .../extract-highbits-sameconstmask.ll | 8 +++---- .../ScalarEvolution/lshr-shl-differentconstmask.ll | 10 ++++---- .../Analysis/ScalarEvolution/nsw-offset-assume.ll | 2 +- llvm/test/Analysis/ScalarEvolution/nsw-offset.ll | 2 +- llvm/test/Analysis/ScalarEvolution/nsw.ll | 4 ++-- .../ScalarEvolution/predicated-trip-count.ll | 2 +- llvm/test/Analysis/ScalarEvolution/sext-mul.ll | 4 ++-- .../ScalarEvolution/shl-lshr-differentconstmask.ll | 2 +- .../Analysis/ScalarEvolution/trip-count-pow2.ll | 2 +- llvm/test/Analysis/ScalarEvolution/zext-mul.ll | 16 +++++-------- .../Transforms/LoopVersioning/incorrect-phi.ll | 18 ++++++++------- 18 files changed, 55 insertions(+), 70 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 6480c2c..38bac43 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2244,35 +2244,22 @@ StrengthenNoWrapFlags(ScalarEvolution *SE, SCEVTypes Type, SignOrUnsignWrap = ScalarEvolution::maskFlags(Flags, SignOrUnsignMask); - if (SignOrUnsignWrap != SignOrUnsignMask && - (Type == scAddExpr || Type == scMulExpr) && Ops.size() == 2 && - isa(Ops[0])) { - - auto Opcode = [&] { - switch (Type) { - case scAddExpr: - return Instruction::Add; - case scMulExpr: - return Instruction::Mul; - default: - llvm_unreachable("Unexpected SCEV op."); - } - }(); + if (SignOrUnsignWrap != SignOrUnsignMask && Type == scAddExpr && + Ops.size() == 2 && isa(Ops[0])) { - const APInt &C = cast(Ops[0])->getAPInt(); + // (A + C) --> (A + C) if the addition does not sign overflow + // (A + C) --> (A + C) if the addition does not unsign overflow - // (A C) --> (A C) if the op doesn't sign overflow. + const APInt &C = cast(Ops[0])->getAPInt(); if (!(SignOrUnsignWrap & SCEV::FlagNSW)) { auto NSWRegion = ConstantRange::makeGuaranteedNoWrapRegion( - Opcode, C, OBO::NoSignedWrap); + Instruction::Add, C, OBO::NoSignedWrap); if (NSWRegion.contains(SE->getSignedRange(Ops[1]))) Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNSW); } - - // (A C) --> (A C) if the op doesn't unsign overflow. if (!(SignOrUnsignWrap & SCEV::FlagNUW)) { auto NUWRegion = ConstantRange::makeGuaranteedNoWrapRegion( - Opcode, C, OBO::NoUnsignedWrap); + Instruction::Add, C, OBO::NoUnsignedWrap); if (NUWRegion.contains(SE->getUnsignedRange(Ops[1]))) Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNUW); } diff --git a/llvm/test/Analysis/Delinearization/a.ll b/llvm/test/Analysis/Delinearization/a.ll index df0e2b1..a105c20 100644 --- a/llvm/test/Analysis/Delinearization/a.ll +++ b/llvm/test/Analysis/Delinearization/a.ll @@ -10,7 +10,7 @@ ; AddRec: {{{(28 + (4 * (-4 + (3 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(12 * %o)}<%for.j>,+,20}<%for.k> ; CHECK: Base offset: %A ; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of 4 bytes. -; CHECK: ArrayRef[{3,+,2}<%for.i>][{-4,+,3}<%for.j>][{7,+,5}<%for.k>] +; CHECK: ArrayRef[{3,+,2}<%for.i>][{-4,+,3}<%for.j>][{7,+,5}<%for.k>] define void @foo(i64 %n, i64 %m, i64 %o, i32* nocapture %A) #0 { entry: diff --git a/llvm/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll b/llvm/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll index bd98d0a..bd2f34d 100644 --- a/llvm/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll +++ b/llvm/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll @@ -11,7 +11,7 @@ ; AddRec: {{((%m * %b * 8) + %A),+,(2 * %m * 8)}<%for.i>,+,(2 * 8)}<%for.j> ; CHECK: Base offset: %A ; CHECK: ArrayDecl[UnknownSize][%m] with elements of 8 bytes. -; CHECK: ArrayRef[{%b,+,2}<%for.i>][{0,+,2}<%for.j>] +; CHECK: ArrayRef[{%b,+,2}<%for.i>][{0,+,2}<%for.j>] define void @foo(i64 %n, i64 %m, i64 %b, double* %A) { diff --git a/llvm/test/Analysis/IVUsers/quadradic-exit-value.ll b/llvm/test/Analysis/IVUsers/quadradic-exit-value.ll index 1597bfa..afc2151 100644 --- a/llvm/test/Analysis/IVUsers/quadradic-exit-value.ll +++ b/llvm/test/Analysis/IVUsers/quadradic-exit-value.ll @@ -70,7 +70,7 @@ exit: ; sure they aren't marked as post-inc users. ; ; CHECK-LABEL: IV Users for loop %test2.loop -; CHECK-NO-LCSSA: %sub.cond.us = ((-1 * %sub.us) + {0,+,1}<%test2.loop>) (post-inc with loop %test2.loop) in %sext.us = mul i32 %mul.us, %sub.cond.us +; CHECK-NO-LCSSA: %sub.cond.us = ((-1 * %sub.us) + {0,+,1}<%test2.loop>) (post-inc with loop %test2.loop) in %sext.us = mul i32 %mul.us, %sub.cond.us define i32 @test2() { entry: br label %test2.loop diff --git a/llvm/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll b/llvm/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll index 4528976..2bae486 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll @@ -251,10 +251,10 @@ for.end: ; preds = %for.body ; CHECK-NEXT: Member: {((2 * %offset) + %a),+,2}<%for.body> ; CHECK-NEXT: Group {{.*}}[[ONE]]: ; CHECK-NEXT: (Low: %a High: (10000 + %a)) -; CHECK-NEXT: Member: {%a,+,2}<%for.body> +; CHECK-NEXT: Member: {%a,+,2}<%for.body> ; CHECK-NEXT: Group {{.*}}[[TWO]]: ; CHECK-NEXT: (Low: (20000 + %a) High: (30000 + %a)) -; CHECK-NEXT: Member: {(20000 + %a),+,2}<%for.body> +; CHECK-NEXT: Member: {(20000 + %a),+,2}<%for.body> define void @testi(i16* %a, i64 %offset) { diff --git a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll index a7e5bce..d448a27 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll @@ -33,7 +33,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ; i64 {0,+,2}<%for.body> ; LAA: [PSE] %arrayidxA = getelementptr i16, i16* %a, i64 %mul_ext: -; LAA-NEXT: ((2 * (zext i32 {0,+,2}<%for.body> to i64)) + %a) +; LAA-NEXT: ((2 * (zext i32 {0,+,2}<%for.body> to i64)) + %a) ; LAA-NEXT: --> {%a,+,4}<%for.body> @@ -130,7 +130,7 @@ for.end: ; preds = %for.body ; i64 {zext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body> ; LAA: [PSE] %arrayidxA = getelementptr i16, i16* %a, i64 %mul_ext: -; LAA-NEXT: ((2 * (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)) + %a) +; LAA-NEXT: ((2 * (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)) + %a) ; LAA-NEXT: --> {((4 * (zext i31 (trunc i64 %N to i31) to i64)) + %a),+,-4}<%for.body> ; LV-LABEL: f2 @@ -210,7 +210,7 @@ for.end: ; preds = %for.body ; i64 {0,+,2}<%for.body> ; LAA: [PSE] %arrayidxA = getelementptr i16, i16* %a, i64 %mul_ext: -; LAA-NEXT: ((2 * (sext i32 {0,+,2}<%for.body> to i64)) + %a) +; LAA-NEXT: ((2 * (sext i32 {0,+,2}<%for.body> to i64)) + %a) ; LAA-NEXT: --> {%a,+,4}<%for.body> ; LV-LABEL: f3 @@ -278,7 +278,7 @@ for.end: ; preds = %for.body ; LAA: Memory dependences are safe{{$}} ; LAA: SCEV assumptions: ; LAA-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: -; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: +; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: ; The expression for %mul_ext as analyzed by SCEV is ; i64 (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64) @@ -286,8 +286,8 @@ for.end: ; preds = %for.body ; i64 {sext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body> ; LAA: [PSE] %arrayidxA = getelementptr i16, i16* %a, i64 %mul_ext: -; LAA-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)) + %a) -; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> +; LAA-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)) + %a) +; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> ; LV-LABEL: f4 ; LV-LABEL: for.body.lver.check @@ -362,11 +362,11 @@ for.end: ; preds = %for.body ; LAA: Memory dependences are safe{{$}} ; LAA: SCEV assumptions: ; LAA-NEXT: {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> Added Flags: -; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: +; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: ; LAA: [PSE] %arrayidxA = getelementptr inbounds i16, i16* %a, i32 %mul: ; LAA-NEXT: ((2 * (sext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)) + %a) -; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> +; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> ; LV-LABEL: f5 ; LV-LABEL: for.body.lver.check diff --git a/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll b/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll index 1af5035..b54baee 100644 --- a/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll +++ b/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll @@ -322,7 +322,7 @@ define void @test_05(i32 %N) { ; CHECK: %SQ = mul i32 %i.0, %i.0 ; CHECK-NEXT: --> {4,+,5,+,2}<%bb3> ; CHECK: %tmp4 = mul i32 %i.0, 2 -; CHECK-NEXT: --> {4,+,2}<%bb3> +; CHECK-NEXT: --> {4,+,2}<%bb3> ; CHECK: %tmp5 = sub i32 %SQ, %tmp4 ; CHECK-NEXT: --> {0,+,3,+,2}<%bb3> diff --git a/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll b/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll index 6b0f858..851dce6 100644 --- a/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/extract-highbits-sameconstmask.ll @@ -8,7 +8,7 @@ define i32 @div(i32 %val) nounwind { ; CHECK-NEXT: %tmp1 = udiv i32 %val, 16 ; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 16 -; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) +; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) ; CHECK-NEXT: Determining loop execution counts for: @div ; %tmp1 = udiv i32 %val, 16 @@ -22,7 +22,7 @@ define i32 @sdiv(i32 %val) nounwind { ; CHECK-NEXT: %tmp1 = sdiv i32 %val, 16 ; CHECK-NEXT: --> %tmp1 U: full-set S: [-134217728,134217728) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 16 -; CHECK-NEXT: --> (16 * %tmp1) U: [0,-15) S: [-2147483648,2147483633) +; CHECK-NEXT: --> (16 * %tmp1) U: [0,-15) S: [-2147483648,2147483633) ; CHECK-NEXT: Determining loop execution counts for: @sdiv ; %tmp1 = sdiv i32 %val, 16 @@ -38,7 +38,7 @@ define i32 @mask_b(i32 %val) nounwind { ; CHECK-LABEL: 'mask_b' ; CHECK-NEXT: Classifying expressions for: @mask_b ; CHECK-NEXT: %masked = and i32 %val, -16 -; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) +; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) ; CHECK-NEXT: Determining loop execution counts for: @mask_b ; %masked = and i32 %val, -16 @@ -51,7 +51,7 @@ define i32 @mask_d(i32 %val) nounwind { ; CHECK-NEXT: %lowbitscleared = lshr i32 %val, 4 ; CHECK-NEXT: --> (%val /u 16) U: [0,268435456) S: [0,268435456) ; CHECK-NEXT: %masked = shl i32 %lowbitscleared, 4 -; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) +; CHECK-NEXT: --> (16 * (%val /u 16)) U: [0,-15) S: [0,-15) ; CHECK-NEXT: Determining loop execution counts for: @mask_d ; %lowbitscleared = lshr i32 %val, 4 diff --git a/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll b/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll index 89c31d12..0955d3e 100644 --- a/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/lshr-shl-differentconstmask.ll @@ -8,7 +8,7 @@ define i32 @udiv_biggerLshr(i32 %val) nounwind { ; CHECK-NEXT: %tmp1 = udiv i32 %val, 64 ; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = mul i32 %tmp1, 16 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @udiv_biggerLshr ; %tmp1 = udiv i32 %val, 64 @@ -38,7 +38,7 @@ define i32 @shifty_biggerLshr(i32 %val) { ; CHECK-NEXT: %tmp1 = lshr i32 %val, 6 ; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 4 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr ; %tmp1 = lshr i32 %val, 6 @@ -52,7 +52,7 @@ define i32 @shifty_biggerLshr_lshrexact(i32 %val) { ; CHECK-NEXT: %tmp1 = lshr exact i32 %val, 6 ; CHECK-NEXT: --> (%val /u 64) U: [0,67108864) S: [0,67108864) ; CHECK-NEXT: %tmp2 = shl i32 %tmp1, 4 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @shifty_biggerLshr_lshrexact ; %tmp1 = lshr exact i32 %val, 6 @@ -96,7 +96,7 @@ define i32 @masky_biggerLshr(i32 %val) { ; CHECK-NEXT: %tmp1 = lshr i32 %val, 2 ; CHECK-NEXT: --> (%val /u 4) U: [0,1073741824) S: [0,1073741824) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, -16 -; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) +; CHECK-NEXT: --> (16 * (%val /u 64)) U: [0,1073741809) S: [0,1073741809) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerLshr ; %tmp1 = lshr i32 %val, 2 @@ -121,7 +121,7 @@ define i32 @masky_biggerShr(i32 %val) { ; CHECK-NEXT: %tmp1 = shl i32 %val, 2 ; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, -64 -; CHECK-NEXT: --> (64 * (zext i26 (trunc i32 (%val /u 16) to i26) to i32)) U: [0,-63) S: [0,-63) +; CHECK-NEXT: --> (64 * (zext i26 (trunc i32 (%val /u 16) to i26) to i32)) U: [0,-63) S: [0,-63) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShr ; %tmp1 = shl i32 %val, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll b/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll index 3ef31ff..5413b47 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw-offset-assume.ll @@ -79,5 +79,5 @@ declare void @llvm.assume(i1) nounwind ; Note: Without the preheader assume, there is an 'smax' in the ; backedge-taken count expression: -; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) +; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK: Loop %bb: max backedge-taken count is 1073741822 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll b/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll index a5c4b57..f8ed8f0 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw-offset.ll @@ -73,5 +73,5 @@ return: ; preds = %bb1.return_crit_edg ret void } -; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) +; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))) /u 2) ; CHECK: Loop %bb: max backedge-taken count is 1073741822 diff --git a/llvm/test/Analysis/ScalarEvolution/nsw.ll b/llvm/test/Analysis/ScalarEvolution/nsw.ll index ca24f9d..39b958d 100644 --- a/llvm/test/Analysis/ScalarEvolution/nsw.ll +++ b/llvm/test/Analysis/ScalarEvolution/nsw.ll @@ -126,7 +126,7 @@ exit: } ; CHECK-LABEL: PR12375 -; CHECK: --> {(4 + %arg),+,4}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg) umax (8 + %arg))) /u 4)) + %arg) +; CHECK: --> {(4 + %arg),+,4}<%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg) umax (8 + %arg))) /u 4)) + %arg) define i32 @PR12375(i32* readnone %arg) { bb: %tmp = getelementptr inbounds i32, i32* %arg, i64 2 @@ -145,7 +145,7 @@ bb7: ; preds = %bb1 } ; CHECK-LABEL: PR12376 -; CHECK: --> {(4 + %arg),+,4}<%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg) umax %arg1)) /u 4)) + %arg) +; CHECK: --> {(4 + %arg),+,4}<%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg) umax %arg1)) /u 4)) + %arg) define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1) { bb: br label %bb2 diff --git a/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll b/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll index a0afcf4..2db0a8b 100644 --- a/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll +++ b/llvm/test/Analysis/ScalarEvolution/predicated-trip-count.ll @@ -80,7 +80,7 @@ return: ; preds = %bb5 ; CHECK-NEXT: --> (sext i16 {%Start,+,-1}<%bb3> to i32) ; CHECK: Loop %bb3: Unpredictable backedge-taken count. ; CHECK-NEXT: Loop %bb3: Unpredictable max backedge-taken count. -; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is (2 + (sext i16 %Start to i32) + ((-2 + (-1 * (sext i16 %Start to i32))) smax (-1 + (-1 * %M)))) +; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is (2 + (sext i16 %Start to i32) + ((-2 + (-1 * (sext i16 %Start to i32))) smax (-1 + (-1 * %M)))) ; CHECK-NEXT: Predicates: ; CHECK-NEXT: {%Start,+,-1}<%bb3> Added Flags: diff --git a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll index 8fe22db..ca25d9e 100644 --- a/llvm/test/Analysis/ScalarEvolution/sext-mul.ll +++ b/llvm/test/Analysis/ScalarEvolution/sext-mul.ll @@ -5,11 +5,11 @@ ; CHECK: %tmp10 = ashr exact i64 %tmp9, 32 ; CHECK-NEXT: --> {{.*}} Exits: (sext i32 (-2 + (2 * %arg2)) to i64) ; CHECK: %tmp11 = getelementptr inbounds i32, i32* %arg, i64 %tmp10 -; CHECK-NEXT: --> {{.*}} Exits: ((4 * (sext i32 (-2 + (2 * %arg2)) to i64)) + %arg) +; CHECK-NEXT: --> {{.*}} Exits: ((4 * (sext i32 (-2 + (2 * %arg2)) to i64)) + %arg) ; CHECK: %tmp14 = or i64 %tmp10, 1 ; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i32 (-2 + (2 * %arg2)) to i64)) ; CHECK: %tmp15 = getelementptr inbounds i32, i32* %arg, i64 %tmp14 -; CHECK-NEXT: --> {{.*}} Exits: (4 + (4 * (sext i32 (-2 + (2 * %arg2)) to i64)) + %arg) +; CHECK-NEXT: --> {{.*}} Exits: (4 + (4 * (sext i32 (-2 + (2 * %arg2)) to i64)) + %arg) ; CHECK:Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg2 to i64)) ; CHECK-NEXT:Loop %bb7: max backedge-taken count is -1 ; CHECK-NEXT:Loop %bb7: Predicated backedge-taken count is (-1 + (zext i32 %arg2 to i64)) diff --git a/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll b/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll index 1886848..be97990 100644 --- a/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll +++ b/llvm/test/Analysis/ScalarEvolution/shl-lshr-differentconstmask.ll @@ -96,7 +96,7 @@ define i32 @masky_biggerShl(i32 %val) { ; CHECK-NEXT: %tmp1 = shl i32 %val, 2 ; CHECK-NEXT: --> (4 * %val) U: [0,-3) S: [-2147483648,2147483645) ; CHECK-NEXT: %tmp2 = and i32 %tmp1, 268435452 -; CHECK-NEXT: --> (4 * (zext i26 (trunc i32 %val to i26) to i32)) U: [0,268435453) S: [0,268435453) +; CHECK-NEXT: --> (4 * (zext i26 (trunc i32 %val to i26) to i32)) U: [0,268435453) S: [0,268435453) ; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShl ; %tmp1 = shl i32 %val, 2 diff --git a/llvm/test/Analysis/ScalarEvolution/trip-count-pow2.ll b/llvm/test/Analysis/ScalarEvolution/trip-count-pow2.ll index 3a6f5fe..04d1b95 100644 --- a/llvm/test/Analysis/ScalarEvolution/trip-count-pow2.ll +++ b/llvm/test/Analysis/ScalarEvolution/trip-count-pow2.ll @@ -31,7 +31,7 @@ exit: ret i32 %i ; CHECK-LABEL: @test2 -; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * (%n /u 32))) /u 32) +; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * (%n /u 32))) /u 32) ; CHECK: Loop %loop: max backedge-taken count is 134217727 } diff --git a/llvm/test/Analysis/ScalarEvolution/zext-mul.ll b/llvm/test/Analysis/ScalarEvolution/zext-mul.ll index 0c0f16c..ae93a92 100644 --- a/llvm/test/Analysis/ScalarEvolution/zext-mul.ll +++ b/llvm/test/Analysis/ScalarEvolution/zext-mul.ll @@ -19,20 +19,16 @@ define void @no_range() { } ; CHECK-LABEL: @range +; +; This had to be disabled when r334428 was reverted. We should enable this test +; when r334428 is reapplied with a fix. define void @range() { - %a = call i32 @get_int(), !range !{i32 0, i32 100} + %a = call i32 @get_int(), !range !0 %b = mul i32 %a, 4 %c = zext i32 %b to i64 ; CHECK: %c - ; CHECK-NEXT: --> (4 * (zext i32 %a to i64)) + ; CHECK-NEXT: --> (zext i32 (4 * %a) to i64) ret void } -; CHECK-LABEL: @no_nuw -define void @no_nuw() { - %a = call i32 @get_int(), !range !{i32 0, i32 3} - %b = mul i32 %a, -100 - ; CHECK: %b - ; CHECK-NEXT: --> (-100 * %a) - ret void -} +!0 = !{i32 0, i32 100} diff --git a/llvm/test/Transforms/LoopVersioning/incorrect-phi.ll b/llvm/test/Transforms/LoopVersioning/incorrect-phi.ll index de170be..fcecdb3 100644 --- a/llvm/test/Transforms/LoopVersioning/incorrect-phi.ll +++ b/llvm/test/Transforms/LoopVersioning/incorrect-phi.ll @@ -14,17 +14,18 @@ bb6.lr.ph: ; preds = %bb5.preheader br label %bb6 bb6: ; preds = %bb6.lr.ph, %bb6 - %_tmp1423 = phi i64 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ] + %_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ] %_tmp123 = getelementptr [2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i16 0, i64 undef - %_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp1423 + %_tmp125 = sext i16 %_tmp1423 to i64 + %_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125 %_tmp129 = getelementptr [5 x i16], [5 x i16]* %_tmp126, i16 0, i64 undef %_tmp130 = load i16, i16* %_tmp129 store i16 undef, i16* getelementptr ([2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i64 0, i64 undef, i64 undef, i64 undef) - %_tmp142 = add i64 %_tmp1423, 1 + %_tmp142 = add i16 %_tmp1423, 1 br i1 false, label %bb6, label %loop.exit loop.exit: ; preds = %bb6 - %_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ] + %_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ] %split = phi i16 [ undef, %bb6 ] ; CHECK: %split = phi i16 [ undef, %bb6 ], [ undef, %bb6.lver.orig ] br label %bb9 @@ -40,17 +41,18 @@ bb6.lr.ph: ; preds = %bb5.preheader br label %bb6 bb6: ; preds = %bb6.lr.ph, %bb6 - %_tmp1423 = phi i64 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ] + %_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ] %_tmp123 = getelementptr [2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i16 0, i64 undef - %_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp1423 + %_tmp125 = sext i16 %_tmp1423 to i64 + %_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125 %_tmp129 = getelementptr [5 x i16], [5 x i16]* %_tmp126, i16 0, i64 undef %_tmp130 = load i16, i16* %_tmp129 store i16 undef, i16* getelementptr ([2 x [3 x [5 x i16]]], [2 x [3 x [5 x i16]]]* @x, i64 0, i64 undef, i64 undef, i64 undef) - %_tmp142 = add i64 %_tmp1423, 1 + %_tmp142 = add i16 %_tmp1423, 1 br i1 false, label %bb6, label %loop.exit loop.exit: ; preds = %bb6 - %_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ] + %_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ] %split = phi i16 [ %t, %bb6 ] ; CHECK: %split = phi i16 [ %t, %bb6 ], [ %t, %bb6.lver.orig ] br label %bb9 -- 2.7.4