aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h2
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index e077cfe..76f4b2c 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -407,7 +407,7 @@ namespace llvm {
/// 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());
}
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 07850f7..593e273 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -147,7 +147,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
}
// {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 *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
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.