[llvm-commits] [llvm] r52614 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolutionExpander.cpp
Dan Gohman
gohman at apple.com
Sun Jun 22 12:23:09 PDT 2008
Author: djg
Date: Sun Jun 22 14:23:09 2008
New Revision: 52614
URL: http://llvm.org/viewvc/llvm-project?rev=52614&view=rev
Log:
Use SCEVAddRecExpr::isAffine.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=52614&r1=52613&r2=52614&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Sun Jun 22 14:23:09 2008
@@ -407,7 +407,7 @@
/// indicating how much this expression steps by. If this is a polynomial
/// of degree N, it returns a chrec of degree N-1.
SCEVHandle getStepRecurrence(ScalarEvolution &SE) const {
- if (getNumOperands() == 2) return getOperand(1);
+ if (isAffine()) return getOperand(1);
return SE.getAddRecExpr(std::vector<SCEVHandle>(op_begin()+1,op_end()),
getLoop());
}
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=52614&r1=52613&r2=52614&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Sun Jun 22 14:23:09 2008
@@ -147,7 +147,7 @@
}
// {0,+,1} --> Insert a canonical induction variable into the loop!
- if (S->getNumOperands() == 2 &&
+ if (S->isAffine() &&
S->getOperand(1) == SE.getIntegerSCEV(1, Ty)) {
// Create and insert the PHI node for the induction variable in the
// specified loop.
@@ -178,7 +178,7 @@
Value *I = getOrInsertCanonicalInductionVariable(L, Ty);
// If this is a simple linear addrec, emit it now as a special case.
- if (S->getNumOperands() == 2) { // {0,+,F} --> i*F
+ if (S->isAffine()) { // {0,+,F} --> i*F
Value *F = expand(S->getOperand(1));
// IF the step is by one, just return the inserted IV.
More information about the llvm-commits
mailing list