[llvm-commits] [llvm] r111037 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Dan Gohman
gohman at apple.com
Fri Aug 13 13:17:14 PDT 2010
Author: djg
Date: Fri Aug 13 15:17:14 2010
New Revision: 111037
URL: http://llvm.org/viewvc/llvm-project?rev=111037&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=111037&r1=111036&r2=111037&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Aug 13 15:17:14 2010
@@ -1383,7 +1383,7 @@
// 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 @@
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 *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 *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:
More information about the llvm-commits
mailing list