[llvm-commits] [llvm] r127593 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Andrew Trick
atrick at apple.com
Mon Mar 14 10:38:55 PDT 2011
Author: atrick
Date: Mon Mar 14 12:38:54 2011
New Revision: 127593
URL: http://llvm.org/viewvc/llvm-project?rev=127593&view=rev
Log:
Negating a recurrence preserves no-self-wrap.
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=127593&r1=127592&r2=127593&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Mar 14 12:38:54 2011
@@ -1792,6 +1792,17 @@
if (AnyFolded)
return getAddExpr(NewOps);
}
+ else if (const SCEVAddRecExpr *
+ AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) {
+ // Negation preserves a recurrence's no self-wrap property.
+ SmallVector<const SCEV *, 4> Operands;
+ for (SCEVAddRecExpr::op_iterator I = AddRec->op_begin(),
+ E = AddRec->op_end(); I != E; ++I) {
+ Operands.push_back(getMulExpr(Ops[0], *I));
+ }
+ return getAddRecExpr(Operands, AddRec->getLoop(),
+ AddRec->getNoWrapFlags(SCEV::FlagNW));
+ }
}
}
More information about the llvm-commits
mailing list