]> granicus.if.org Git - llvm/commitdiff
Revert r282872 "CVP. Turn marking adds as no wrap on by default"
authorHans Wennborg <hans@hanshq.net>
Thu, 23 Feb 2017 22:29:00 +0000 (22:29 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 23 Feb 2017 22:29:00 +0000 (22:29 +0000)
While not CVP's fault, this caused miscompiles (PR31181). Reverting
until those are resolved.

(This also reverts the follow-ups r288154 and r288161 which removed the
flag.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296030 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/add.ll

index 60786a3373feb4683c055983c68d04cee40978de..d4d5ef4b1584aaaac4ef868ab1e9cfe1b792a661 100644 (file)
@@ -41,6 +41,8 @@ STATISTIC(NumSDivs,     "Number of sdiv converted to udiv");
 STATISTIC(NumAShrs,     "Number of ashr converted to lshr");
 STATISTIC(NumSRems,     "Number of srem converted to urem");
 
+static cl::opt<bool> DontProcessAdds("cvp-dont-process-adds", cl::init(true));
+
 namespace {
   class CorrelatedValuePropagation : public FunctionPass {
   public:
@@ -405,6 +407,9 @@ static bool processAShr(BinaryOperator *SDI, LazyValueInfo *LVI) {
 static bool processAdd(BinaryOperator *AddOp, LazyValueInfo *LVI) {
   typedef OverflowingBinaryOperator OBO;
 
+  if (DontProcessAdds)
+    return false;
+
   if (AddOp->getType()->isVectorTy() || hasLocalDefs(AddOp))
     return false;
 
index 4b436ff9a4014d5d08e098de481ef056009dd326..0ba521c894e2f800b8bd4e3e0e5e917b173d07f5 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -correlated-propagation -S | FileCheck %s
+; RUN: opt < %s -correlated-propagation -cvp-dont-process-adds=false -S | FileCheck %s
 
 ; CHECK-LABEL: @test0(
 define void @test0(i32 %a) {