aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
AgeCommit message (Collapse)Author
2010-08-29Restructure the {A,+,B}<L> * {C,+,D}<L> folding so that it foldsDan Gohman
all applicable addrecs before recursing on getMulExpr, instead of recursing on getMulExpr for each one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Batch up subtracts along with adds, when analyzing long chains ofDan Gohman
operations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Micro-optimize GroupByComplexity.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112431 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Hold AddRec->getLoop() in a variable, to make the Mul code more consistentDan Gohman
with the Add code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112430 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Rename a variable, for consistency.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29Use iterators instead of indices.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28Fix an index calculation thinko.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112337 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27When merging adjacent operands, scan ahead and merge all equalDan Gohman
adjacent operands at once, instead of just two at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112299 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Make the {A,+,B}<L> + {C,+,D}<L> --> Other + {A+C,+,B+D}<L>Dan Gohman
transformation collect all the addrecs with the same loop add combine them at once rather than starting everything over at the first chance. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112290 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Switch ScalarEvolution's main Value*->SCEV* map from std::mapDan Gohman
to DenseMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27Optimize SCEVComplexityCompare. Use a 3-way return instead of a 2-wayDan Gohman
return to avoid needing two calls to test for equivalence, and sort addrecs by their degree before examining their operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16To create a copy of a SmallVector with an element removed from theDan Gohman
middle, copy the elements in two groups, rather than copying all the elements and then doing an erase on the middle of the result. These are SmallVectors, so we shouldn't expect to hit dynamic allocation in the common case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111151 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Tidy whitespace.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Add a comment.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111145 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Use const_iterator in a few places.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Use iterators instead of indices in a few more places.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Micro-optimize SCEVConstant comparison.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Move SCEVNAryExpr's virtual member functions out of line, and convertDan Gohman
them to iterators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111140 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Use iterators instead of indices in simple cases.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Avoid gratuitous inefficiency in ifndef NDEBUG code.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Make one getAddExpr call when analyzing a+b+c+d+e+... instead of oneDan Gohman
for each add instruction. Ditto for Mul. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111136 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Delete an unused function.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13Various optimizations. Don't compare two loops' depthsDan Gohman
when they are the same loop. Don't compare two instructions' loop depths when they are in the same block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13When testing whether one loop contains another, test this directlyDan Gohman
rather than testing whether the loop contains the other's header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13Add a const.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13When creating a symmetric SCEV with a constant operand, putDan Gohman
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
2010-08-13An add recurrence is loop-invariant in any loop inside of itsDan Gohman
associated loop. This avoids potentially expensive traversals of the add recurrence's operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Optimize ScalarEvolution::getAddExpr's operand factoring code byDan Gohman
having it finish processing all of the muliply operands before starting the whole getAddExpr process over again, instead of immediately after the first simplification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110916 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Hoist some loop-invariant code out of a hot loop.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12Optimize ScalarEvolution::getAddExpr's duplicate operand detectionDan Gohman
by having it finish processing the whole operand list before starting the whole getAddExpr process over again, instead of immediately after the first duplicate is found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11When analyzing loop exit conditions combined with and and or, don'tDan Gohman
make any assumptions about when the two conditions will agree on when to permit the loop to exit. This fixes PR7845. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10Rename and reorder the arguments to isImpliedCond, for consistency and clarity.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06Revert r110396 to fix buildbots.Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson
address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04Fix a minor bug which resulted in intermediate calculationsDan Gohman
using wider types than are necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Make SCEVUnknown a CallbackVH, so that it can be notified directlyDan Gohman
of Value deletions and RAUWs, instead of relying on ScalarEvolution's Scalars map being notified, as that's complicated at best, and insufficient in general. This means SCEVUnknown needs a non-trivial destructor, so introduce a mechanism to allow ScalarEvolution to locate all the SCEVUnknowns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Prefix `next' iterator operation with `llvm::'.Oscar Fuentes
Fixes potential ambiguity problems on VS 2010. Patch by nobled! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Speculatively revert r109705 since it seems to be causing some build botEric Christopher
angst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109718 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Factor out some of the code for updating old SCEVUnknown values, andDan Gohman
extend it to handle the case where multiple RAUWs affect a single SCEVUnknown. Add a ScalarEvolution unittest to test for this situation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28Make SCEVCallbackVH::allUsesReplacedWith update the old SCEVUnknownDan Gohman
object, as it may still be referenced by SCEVs not cleaned up by the use list traversal. Also, in ScalarEvolution::forgetValue, only check for a SCEVUnknown object for the original value, not for any value in the use list, because other SCEVUnknown values aren't necessary obsolete at that point. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109570 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28Make SCEVCallbackVH::allUsesReplacedWith unconditionally deleteDan Gohman
the old value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109567 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23Micro-optimize SCEVComplexityCompare.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23Add a const qualifier.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109266 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22mass elimination of reliance on automatic iterator dereferencingGabor Greif
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109103 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20Add a fast path for x - x.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15Teach ScalarEvolution how to fold trunc(undef) and anyext(undef) to undef.Dan Gohman
This helps LSR behave more consistently on bugpoint-reduced testcases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30In ScalarEvolution::forgetValue, eliminate any SCEVUnknownDan Gohman
entries associated with the value being erased in the folding set map. These entries used to be harmless, because a SCEVUnknown doesn't store any information about its Value*, so having a new Value allocated at the old Value's address wasn't a problem. But now that ScalarEvolution is storing more information about values, this is no longer safe. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107316 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30Revert the part of r107257 which introduced new logic for usingDan Gohman
nsw and nuw flags from IR Instructions. On further consideration, this isn't valid. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107298 91177308-0d34-0410-b5e6-96231b3b80d8