diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-13 20:17:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-13 20:17:14 +0000 |
commit | 58a85b96b887f1abbdd3deec5c44844d24393077 (patch) | |
tree | 5b184622f2e8b74cd3b008f335ec5a192c3bca71 /lib/Analysis/ScalarEvolution.cpp | |
parent | 71c4144076d35bd45f8a5103357532f958de6757 (diff) |
When creating a symmetric SCEV with a constant operand, put
the constant operand on the left, as that's where ScalarEvolution
will end up canonicalizing to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index dee7a1f8d9..048fe513a2 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1383,7 +1383,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, // Found a match, merge the two values into a multiply, and add any // remaining values to the result. const SCEV *Two = getConstant(Ty, 2); - const SCEV *Mul = getMulExpr(Ops[i], Two); + const SCEV *Mul = getMulExpr(Two, Ops[i]); if (Ops.size() == 2) return Mul; Ops[i] = Mul; @@ -1530,7 +1530,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, InnerMul = getMulExpr(MulOps); } const SCEV *One = getConstant(Ty, 1); - const SCEV *AddOne = getAddExpr(InnerMul, One); + const SCEV *AddOne = getAddExpr(One, InnerMul); const SCEV *OuterMul = getMulExpr(AddOne, MulOpSCEV); if (Ops.size() == 2) return OuterMul; if (AddOp < Idx) { @@ -3538,7 +3538,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { const SCEV *LDiff = getMinusSCEV(LA, LS); const SCEV *RDiff = getMinusSCEV(RA, One); if (LDiff == RDiff) - return getAddExpr(getUMaxExpr(LS, One), LDiff); + return getAddExpr(getUMaxExpr(One, LS), LDiff); } break; case ICmpInst::ICMP_EQ: @@ -3553,7 +3553,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { const SCEV *LDiff = getMinusSCEV(LA, One); const SCEV *RDiff = getMinusSCEV(RA, LS); if (LDiff == RDiff) - return getAddExpr(getUMaxExpr(LS, One), LDiff); + return getAddExpr(getUMaxExpr(One, LS), LDiff); } break; default: |