[PATCH] D69203: [CVP] Deduce no-wrap on `mul`

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 01:29:12 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG292771627735: [CVP] Deduce no-wrap on `mul` (authored by lebedev.ri).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69203/new/

https://reviews.llvm.org/D69203

Files:
  llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  llvm/test/Transforms/CorrelatedValuePropagation/mul.ll


Index: llvm/test/Transforms/CorrelatedValuePropagation/mul.ll
===================================================================
--- llvm/test/Transforms/CorrelatedValuePropagation/mul.ll
+++ llvm/test/Transforms/CorrelatedValuePropagation/mul.ll
@@ -7,7 +7,7 @@
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 3
 ; CHECK-NEXT:    br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
 ; CHECK:       bb:
-; CHECK-NEXT:    [[MUL:%.*]] = mul i8 [[A]], 50
+; CHECK-NEXT:    [[MUL:%.*]] = mul nuw nsw i8 [[A]], 50
 ; CHECK-NEXT:    ret i8 [[MUL]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret i8 0
@@ -30,7 +30,7 @@
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 4
 ; CHECK-NEXT:    br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
 ; CHECK:       bb:
-; CHECK-NEXT:    [[MUL:%.*]] = mul i8 [[A]], 50
+; CHECK-NEXT:    [[MUL:%.*]] = mul nuw i8 [[A]], 50
 ; CHECK-NEXT:    ret i8 [[MUL]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret i8 0
@@ -53,7 +53,7 @@
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 6
 ; CHECK-NEXT:    br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
 ; CHECK:       bb:
-; CHECK-NEXT:    [[MUL:%.*]] = mul i8 [[A]], 50
+; CHECK-NEXT:    [[MUL:%.*]] = mul nuw i8 [[A]], 50
 ; CHECK-NEXT:    ret i8 [[MUL]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret i8 0
@@ -101,7 +101,7 @@
 ; CHECK-NEXT:    [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]]
 ; CHECK-NEXT:    br i1 [[COND]], label [[BB:%.*]], label [[EXIT:%.*]]
 ; CHECK:       bb:
-; CHECK-NEXT:    [[MUL:%.*]] = mul i8 [[A]], 50
+; CHECK-NEXT:    [[MUL:%.*]] = mul nsw i8 [[A]], 50
 ; CHECK-NEXT:    ret i8 [[MUL]]
 ; CHECK:       exit:
 ; CHECK-NEXT:    ret i8 0
Index: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -860,6 +860,7 @@
         break;
       case Instruction::Add:
       case Instruction::Sub:
+      case Instruction::Mul:
         BBChanged |= processBinOp(cast<BinaryOperator>(II), LVI);
         break;
       case Instruction::And:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69203.225835.patch
Type: text/x-patch
Size: 2147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191021/ad75078b/attachment.bin>


More information about the llvm-commits mailing list