[llvm] r335016 - Revert "[SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags"

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 21:09:44 PDT 2018


Author: sanjoy
Date: Mon Jun 18 21:09:44 2018
New Revision: 335016

URL: http://llvm.org/viewvc/llvm-project?rev=335016&view=rev
Log:
Revert "[SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags"

This reverts r334428.  It incorrectly marks some multiplications as nuw.  Tim
Shen is working on a proper fix.

Original commit message:

[SCEV] Add nuw/nsw to mul ops in StrengthenNoWrapFlags where safe.

Summary:
Previously we would add them for adds, but not multiplies.

Removed:
    llvm/trunk/test/Analysis/ScalarEvolution/mul-nuw.ll
Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
    llvm/trunk/test/Analysis/Delinearization/a.ll
    llvm/trunk/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll
    llvm/trunk/test/Analysis/IVUsers/quadradic-exit-value.ll
    llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll
    llvm/trunk/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
    llvm/trunk/test/Analysis/ScalarEvolution/different-loops-recs.ll
    llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll
    llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset.ll
    llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll
    llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll
    llvm/trunk/test/Analysis/ScalarEvolution/sext-zero.ll
    llvm/trunk/test/Analysis/ScalarEvolution/trip-count-pow2.ll
    llvm/trunk/test/Analysis/ScalarEvolution/zext-mul.ll
    llvm/trunk/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 18 21:09:44 2018
@@ -2233,32 +2233,19 @@ StrengthenNoWrapFlags(ScalarEvolution *S
 
   SignOrUnsignWrap = ScalarEvolution::maskFlags(Flags, SignOrUnsignMask);
 
-  if (SignOrUnsignWrap != SignOrUnsignMask &&
-      (Type == scAddExpr || Type == scMulExpr) && Ops.size() == 2 &&
-      isa<SCEVConstant>(Ops[0])) {
+  if (SignOrUnsignWrap != SignOrUnsignMask && Type == scAddExpr &&
+      Ops.size() == 2 && isa<SCEVConstant>(Ops[0])) {
 
-    auto Opcode = [&] {
-      switch (Type) {
-      case scAddExpr:
-        return Instruction::Add;
-      case scMulExpr:
-        return Instruction::Mul;
-      default:
-        llvm_unreachable("Unexpected SCEV op.");
-      }
-    }();
+    // (A + C) --> (A + C)<nsw> if the addition does not sign overflow
+    // (A + C) --> (A + C)<nuw> if the addition does not unsign overflow
 
     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(
-          Opcode, C, OBO::NoSignedWrap);
+          Instruction::Add, 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);

Modified: llvm/trunk/test/Analysis/Delinearization/a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Delinearization/a.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/Delinearization/a.ll (original)
+++ llvm/trunk/test/Analysis/Delinearization/a.ll Mon Jun 18 21:09:44 2018
@@ -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}<nw><%for.i>][{-4,+,3}<nw><%for.j>][{7,+,5}<nw><%for.k>]
+; CHECK: ArrayRef[{3,+,2}<%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:

Modified: llvm/trunk/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll (original)
+++ llvm/trunk/test/Analysis/Delinearization/iv_times_constant_in_subscript.ll Mon Jun 18 21:09:44 2018
@@ -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}<nuw><%for.j>]
+; CHECK: ArrayRef[{%b,+,2}<nsw><%for.i>][{0,+,2}<%for.j>]
 
 
 define void @foo(i64 %n, i64 %m, i64 %b, double* %A) {

Modified: llvm/trunk/test/Analysis/IVUsers/quadradic-exit-value.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/IVUsers/quadradic-exit-value.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/IVUsers/quadradic-exit-value.ll (original)
+++ llvm/trunk/test/Analysis/IVUsers/quadradic-exit-value.ll Mon Jun 18 21:09:44 2018
@@ -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)<nuw><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)<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

Modified: llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll (original)
+++ llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll Mon Jun 18 21:09:44 2018
@@ -251,10 +251,10 @@ for.end:
 ; 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}<nw><%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}<nw><%for.body>
+; CHECK-NEXT:         Member: {(20000 + %a),+,2}<%for.body>
 
 define void @testi(i16* %a,
                    i64 %offset) {

Modified: llvm/trunk/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll (original)
+++ llvm/trunk/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll Mon Jun 18 21:09:44 2018
@@ -33,7 +33,7 @@ target datalayout = "e-m:o-i64:64-f80:12
 ;    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))<nuw> + %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:
 ;     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))<nuw> + %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

Modified: llvm/trunk/test/Analysis/ScalarEvolution/different-loops-recs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/different-loops-recs.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/different-loops-recs.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/different-loops-recs.ll Mon Jun 18 21:09:44 2018
@@ -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}<nuw><%bb3>
+; CHECK-NEXT:  -->  {4,+,2}<%bb3>
 ; CHECK:       %tmp5 = sub i32 %SQ, %tmp4
 ; CHECK-NEXT:  -->  {0,+,3,+,2}<%bb3>
 

Removed: llvm/trunk/test/Analysis/ScalarEvolution/mul-nuw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/mul-nuw.ll?rev=335015&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/mul-nuw.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/mul-nuw.ll (removed)
@@ -1,15 +0,0 @@
-; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
-
-; Check that we add nuw to multiplies by a constant where we can infer that the
-; multiply does not have unsigned overflow.
-declare i32 @get_int();
-
-define void @foo() {
-  %a = call i32 @get_int(), !range !0
-  %b = mul i32 %a, 4
-  ; CHECK: %b
-  ; CHECK-NEXT: --> (4 * %a)<nuw>
-  ret void
-}
-
-!0 = !{i32 0, i32 100}

Modified: llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset-assume.ll Mon Jun 18 21:09:44 2018
@@ -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))<nuw>) /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

Modified: llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/nsw-offset.ll Mon Jun 18 21:09:44 2018
@@ -73,5 +73,5 @@ return:
   ret void
 }
 
-; CHECK: Loop %bb: backedge-taken count is ((-1 + (2 * (%no /u 2))<nuw>) /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

Modified: llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/nsw.ll Mon Jun 18 21:09:44 2018
@@ -25,7 +25,7 @@ bb:		; preds = %bb1, %bb.nph
 	%tmp6 = sext i32 %i.01 to i64		; <i64> [#uses=1]
 	%tmp7 = getelementptr double, double* %p, i64 %tmp6		; <double*> [#uses=1]
 ; CHECK: %tmp7
-; CHECK-NEXT:   -->  {%p,+,8}<nw><%bb>
+; CHECK-NEXT:   -->  {%p,+,8}<%bb>
 	store double %tmp5, double* %tmp7, align 8
 	%tmp8 = add nsw i32 %i.01, 1		; <i32> [#uses=2]
 ; CHECK: %tmp8
@@ -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))<nuw> + %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)) + %arg)
 define i32 @PR12375(i32* readnone %arg) {
 bb:
   %tmp = getelementptr inbounds i32, i32* %arg, i64 2
@@ -145,7 +145,7 @@ bb7:
 }
 
 ; 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))<nuw> + %arg)
+; CHECK: -->  {(4 + %arg)<nsw>,+,4}<nuw><%bb2>{{ U: [^ ]+ S: [^ ]+}}{{ *}}Exits: (4 + (4 * ((-1 + (-1 * %arg) + ((4 + %arg)<nsw> umax %arg1)) /u 4)) + %arg)
 define void @PR12376(i32* nocapture %arg, i32* nocapture %arg1)  {
 bb:
   br label %bb2

Modified: llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/sext-mul.ll Mon Jun 18 21:09:44 2018
@@ -1,7 +1,7 @@
 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
 
 ; CHECK: %tmp9 = shl i64 %tmp8, 33
-; CHECK-NEXT: --> {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64))<nuw>)
+; CHECK-NEXT: --> {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64)))
 ; 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
@@ -48,9 +48,9 @@ bb7:
 }
 
 ; CHECK: %t10 = ashr exact i128 %t9, 1
-; CHECK-NEXT: --> {{.*}} Exits: (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))<nuw>) to i128)
+; CHECK-NEXT: --> {{.*}} Exits: (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128)
 ; CHECK: %t14 = or i128 %t10, 1
-; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))<nuw>) to i128))<nsw>
+; CHECK-NEXT: --> {{.*}} Exits: (1 + (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128))<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: Predicated backedge-taken count is (-1 + (zext i32 %arg5 to i128))<nsw>

Modified: llvm/trunk/test/Analysis/ScalarEvolution/sext-zero.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/sext-zero.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/sext-zero.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/sext-zero.ll Mon Jun 18 21:09:44 2018
@@ -1,9 +1,9 @@
 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
 
 ; CHECK:  %tmp9 = shl i64 %tmp8, 33
-; CHECK-NEXT:  -->  {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64))<nuw>)
+; CHECK-NEXT:  -->  {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64)))
 ; CHECK-NEXT:  %tmp10 = ashr exact i64 %tmp9, 0
-; CHECK-NEXT:  -->  {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64))<nuw>)
+; CHECK-NEXT:  -->  {{.*}} Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64)))
 
 define void @foo(i32* nocapture %arg, i32 %arg1, i32 %arg2) {
 bb:

Modified: llvm/trunk/test/Analysis/ScalarEvolution/trip-count-pow2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/trip-count-pow2.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/trip-count-pow2.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/trip-count-pow2.ll Mon Jun 18 21:09:44 2018
@@ -31,7 +31,7 @@ exit:
   ret i32 %i
 
 ; CHECK-LABEL: @test2
-; CHECK: Loop %loop: backedge-taken count is ((-32 + (32 * (%n /u 32))<nuw>) /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
 }
 

Modified: llvm/trunk/test/Analysis/ScalarEvolution/zext-mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/zext-mul.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/zext-mul.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/zext-mul.ll Mon Jun 18 21:09:44 2018
@@ -19,12 +19,15 @@ 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
   %b = mul i32 %a, 4
   %c = zext i32 %b to i64
   ; CHECK: %c
-  ; CHECK-NEXT: --> (4 * (zext i32 %a to i64))<nuw>
+  ; CHECK-NEXT: --> (zext i32 (4 * %a) to i64)
   ret void
 }
 

Modified: llvm/trunk/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll?rev=335016&r1=335015&r2=335016&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll Mon Jun 18 21:09:44 2018
@@ -22,7 +22,7 @@ for.body153:
 ; CHECK: add nuw nsw i64 %indvars.iv, 1
 ; CHECK: sub nsw i64 %indvars.iv, 2
 ; CHECK: sub nsw i64 4, %indvars.iv
-; CHECK: mul nuw nsw i64 %indvars.iv, 8
+; CHECK: mul nsw i64 %indvars.iv, 8
 for.body170:                                      ; preds = %for.body170, %for.body153
   %i2.19 = phi i32 [ %add249, %for.body170 ], [ 0, %for.body153 ]
 




More information about the llvm-commits mailing list