[SCEV] Preserve flags on add/muls in getSCEVATScope
authorPhilip Reames <listmail@philipreames.com>
Wed, 3 Jul 2019 16:34:08 +0000 (16:34 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 3 Jul 2019 16:34:08 +0000 (16:34 +0000)
We haven't changed the set of users, just specialized an operand for those users.  Given that, the previous wrap flags must still be correct.

Sorry for the lack of test case.  Noticed this while working on something else, and haven't figured out to exercise this standalone.

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

lib/Analysis/ScalarEvolution.cpp

index a66e609e4eed2bacbca6d3cc40542d5215190a58..4a98fc537a5d1a00b713bfa8b6266c618aeca4fe 100644 (file)
@@ -8243,9 +8243,9 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
           NewOps.push_back(OpAtScope);
         }
         if (isa<SCEVAddExpr>(Comm))
-          return getAddExpr(NewOps);
+          return getAddExpr(NewOps, Comm->getNoWrapFlags());
         if (isa<SCEVMulExpr>(Comm))
-          return getMulExpr(NewOps);
+          return getMulExpr(NewOps, Comm->getNoWrapFlags());
         if (isa<SCEVMinMaxExpr>(Comm))
           return getMinMaxExpr(Comm->getSCEVType(), NewOps);
         llvm_unreachable("Unknown commutative SCEV type!");