mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Re-apply "[SCEV] Strengthen StrengthenNoWrapFlags (reapply r334428)."
llvm-svn: 337075
This commit is contained in:
parent
7e3a5718b0
commit
fb4d2d1d80
@ -2244,22 +2244,35 @@ StrengthenNoWrapFlags(ScalarEvolution *SE, SCEVTypes Type,
|
||||
|
||||
SignOrUnsignWrap = ScalarEvolution::maskFlags(Flags, SignOrUnsignMask);
|
||||
|
||||
if (SignOrUnsignWrap != SignOrUnsignMask && Type == scAddExpr &&
|
||||
Ops.size() == 2 && isa<SCEVConstant>(Ops[0])) {
|
||||
if (SignOrUnsignWrap != SignOrUnsignMask &&
|
||||
(Type == scAddExpr || Type == scMulExpr) && Ops.size() == 2 &&
|
||||
isa<SCEVConstant>(Ops[0])) {
|
||||
|
||||
// (A + C) --> (A + C)<nsw> if the addition does not sign overflow
|
||||
// (A + C) --> (A + C)<nuw> if the addition does not unsign overflow
|
||||
auto Opcode = [&] {
|
||||
switch (Type) {
|
||||
case scAddExpr:
|
||||
return Instruction::Add;
|
||||
case scMulExpr:
|
||||
return Instruction::Mul;
|
||||
default:
|
||||
llvm_unreachable("Unexpected SCEV op.");
|
||||
}
|
||||
}();
|
||||
|
||||
const APInt &C = cast<SCEVConstant>(Ops[0])->getAPInt();
|
||||
|
||||
// (A <opcode> C) --> (A <opcode> C)<nsw> if the op doesn't sign overflow.
|
||||
if (!(SignOrUnsignWrap & SCEV::FlagNSW)) {
|
||||
auto NSWRegion = ConstantRange::makeGuaranteedNoWrapRegion(
|
||||
Instruction::Add, C, OBO::NoSignedWrap);
|
||||
Opcode, C, OBO::NoSignedWrap);
|
||||
if (NSWRegion.contains(SE->getSignedRange(Ops[1])))
|
||||
Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNSW);
|
||||
}
|
||||
|
||||
// (A <opcode> C) --> (A <opcode> C)<nuw> if the op doesn't unsign overflow.
|
||||
if (!(SignOrUnsignWrap & SCEV::FlagNUW)) {
|
||||
auto NUWRegion = ConstantRange::makeGuaranteedNoWrapRegion(
|
||||
Instruction::Add, C, OBO::NoUnsignedWrap);
|
||||
Opcode, C, OBO::NoUnsignedWrap);
|
||||
if (NUWRegion.contains(SE->getUnsignedRange(Ops[1])))
|
||||
Flags = ScalarEvolution::setFlags(Flags, SCEV::FlagNUW);
|
||||
}
|
||||
|
@ -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}<nw><%for.j>][{7,+,5}<nw><%for.k>]
|
||||
; CHECK: ArrayRef[{3,+,2}<nw><%for.i>][{-4,+,3}<nw><%for.j>][{7,+,5}<nw><%for.k>]
|
||||
|
||||
define void @foo(i64 %n, i64 %m, i64 %o, i32* nocapture %A) #0 {
|
||||
entry:
|
||||
|
@ -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}<nsw><%for.i>][{0,+,2}<%for.j>]
|
||||
; CHECK: ArrayRef[{%b,+,2}<nsw><%for.i>][{0,+,2}<nuw><%for.j>]
|
||||
|
||||
|
||||
define void @foo(i64 %n, i64 %m, i64 %b, double* %A) {
|
||||
|
@ -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)<nsw> + {0,+,1}<nuw><nsw><%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)<nuw><nsw> + {0,+,1}<nuw><nsw><%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
|
||||
|
@ -251,10 +251,10 @@ for.end: ; preds = %for.body
|
||||
; CHECK-NEXT: Member: {((2 * %offset) + %a)<nsw>,+,2}<nsw><%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}<nw><%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}<nw><%for.body>
|
||||
|
||||
define void @testi(i16* %a,
|
||||
i64 %offset) {
|
||||
|
@ -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))<nuw><nsw> + %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))<nuw><nsw> + %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))<nsw> + %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: <nssw>
|
||||
; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: <nusw>
|
||||
; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
|
||||
|
||||
; 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))<nsw> + %a)
|
||||
; LAA-NEXT: --> {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %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: <nssw>
|
||||
; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64)) + %a),+,-4}<%for.body> Added Flags: <nusw>
|
||||
; LAA-NEXT: {((2 * (sext i32 (2 * (trunc i64 %N to i32)) to i64))<nsw> + %a),+,-4}<%for.body> Added Flags: <nusw>
|
||||
|
||||
; 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))<nsw> + %a)<nsw>
|
||||
; 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))<nsw> + %a),+,-4}<%for.body>
|
||||
|
||||
; LV-LABEL: f5
|
||||
; LV-LABEL: for.body.lver.check
|
||||
|
@ -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}<nuw><nsw><%bb3>
|
||||
; CHECK: %tmp5 = sub i32 %SQ, %tmp4
|
||||
; CHECK-NEXT: --> {0,+,3,+,2}<%bb3>
|
||||
|
||||
|
@ -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))<nuw> 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)<nsw> 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))<nuw> 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))<nuw> U: [0,-15) S: [0,-15)
|
||||
; CHECK-NEXT: Determining loop execution counts for: @mask_d
|
||||
;
|
||||
%lowbitscleared = lshr i32 %val, 4
|
||||
|
@ -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))<nuw><nsw> 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))<nuw><nsw> 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))<nuw><nsw> 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))<nuw><nsw> 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))<nuw> U: [0,-63) S: [0,-63)
|
||||
; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShr
|
||||
;
|
||||
%tmp1 = shl i32 %val, 2
|
||||
|
@ -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))<nuw>) /u 2)
|
||||
; CHECK: Loop %bb: max backedge-taken count is 1073741822
|
||||
|
@ -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))<nuw>) /u 2)
|
||||
; CHECK: Loop %bb: max backedge-taken count is 1073741822
|
||||
|
@ -126,7 +126,7 @@ exit:
|
||||
}
|
||||
|
||||
; CHECK-LABEL: PR12375
|
||||
; CHECK: --> {(4 + %arg)<nsw>,+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax (8 + %arg)<nsw>)) /u 4)) + %arg)
|
||||
; CHECK: --> {(4 + %arg)<nsw>,+,4}<nuw><%bb1>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax (8 + %arg)<nsw>)) /u 4))<nuw> + %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)<nsw>,+,4}<nuw><%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax %arg1)) /u 4)) + %arg)
|
||||
; CHECK: --> {(4 + %arg)<nsw>,+,4}<nuw><%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax %arg1)) /u 4))<nuw> + %arg)
|
||||
define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1) {
|
||||
bb:
|
||||
br label %bb2
|
||||
|
@ -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))<nsw>) smax (-1 + (-1 * %M))))
|
||||
; CHECK-NEXT: Predicates:
|
||||
; CHECK-NEXT: {%Start,+,-1}<%bb3> Added Flags: <nssw>
|
||||
|
||||
|
@ -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))<nsw> + %arg)
|
||||
; CHECK: %tmp14 = or i64 %tmp10, 1
|
||||
; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i32 (-2 + (2 * %arg2)) to i64))<nsw>
|
||||
; 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))<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: Predicated backedge-taken count is (-1 + (zext i32 %arg2 to i64))<nsw>
|
||||
|
@ -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))<nuw><nsw> U: [0,268435453) S: [0,268435453)
|
||||
; CHECK-NEXT: Determining loop execution counts for: @masky_biggerShl
|
||||
;
|
||||
%tmp1 = shl i32 %val, 2
|
||||
|
@ -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))<nuw>) /u 32)
|
||||
; CHECK: Loop %loop: max backedge-taken count is 134217727
|
||||
}
|
||||
|
||||
|
@ -19,16 +19,20 @@ 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 !0
|
||||
%a = call i32 @get_int(), !range !{i32 0, i32 100}
|
||||
%b = mul i32 %a, 4
|
||||
%c = zext i32 %b to i64
|
||||
; CHECK: %c
|
||||
; CHECK-NEXT: --> (zext i32 (4 * %a) to i64)
|
||||
; CHECK-NEXT: --> (4 * (zext i32 %a to i64))<nuw><nsw>
|
||||
ret void
|
||||
}
|
||||
|
||||
!0 = !{i32 0, i32 100}
|
||||
; 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)<nsw>
|
||||
ret void
|
||||
}
|
||||
|
@ -14,18 +14,17 @@ bb6.lr.ph: ; preds = %bb5.preheader
|
||||
br label %bb6
|
||||
|
||||
bb6: ; preds = %bb6.lr.ph, %bb6
|
||||
%_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
|
||||
%_tmp1423 = phi i64 [ 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
|
||||
%_tmp125 = sext i16 %_tmp1423 to i64
|
||||
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125
|
||||
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp1423
|
||||
%_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 i16 %_tmp1423, 1
|
||||
%_tmp142 = add i64 %_tmp1423, 1
|
||||
br i1 false, label %bb6, label %loop.exit
|
||||
|
||||
loop.exit: ; preds = %bb6
|
||||
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]
|
||||
%_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ]
|
||||
%split = phi i16 [ undef, %bb6 ]
|
||||
; CHECK: %split = phi i16 [ undef, %bb6 ], [ undef, %bb6.lver.orig ]
|
||||
br label %bb9
|
||||
@ -41,18 +40,17 @@ bb6.lr.ph: ; preds = %bb5.preheader
|
||||
br label %bb6
|
||||
|
||||
bb6: ; preds = %bb6.lr.ph, %bb6
|
||||
%_tmp1423 = phi i16 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
|
||||
%_tmp1423 = phi i64 [ 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
|
||||
%_tmp125 = sext i16 %_tmp1423 to i64
|
||||
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp125
|
||||
%_tmp126 = getelementptr [3 x [5 x i16]], [3 x [5 x i16]]* %_tmp123, i16 0, i64 %_tmp1423
|
||||
%_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 i16 %_tmp1423, 1
|
||||
%_tmp142 = add i64 %_tmp1423, 1
|
||||
br i1 false, label %bb6, label %loop.exit
|
||||
|
||||
loop.exit: ; preds = %bb6
|
||||
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]
|
||||
%_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ]
|
||||
%split = phi i16 [ %t, %bb6 ]
|
||||
; CHECK: %split = phi i16 [ %t, %bb6 ], [ %t, %bb6.lver.orig ]
|
||||
br label %bb9
|
||||
|
Loading…
x
Reference in New Issue
Block a user