aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
AgeCommit message (Collapse)Author
2010-06-30Improve ScalarEvolution's nsw and nuw preservation.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30When computing a new ConservativeResult, intersect it withDan Gohman
the old one instead of replacing it, to be more precise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29Fix ScalarEvolution's tripcount computation for chains of loopsDan Gohman
where each loop's induction variable's start value is the exit value of a preceding loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29Just as its not safe to blindly transfer the nsw bit from an addDan Gohman
instruction to an add scev, it's not safe to blindly transfer the inbounds flag from a gep instruction to an nsw on the scev for the gep. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107117 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25Eliminate a redundant FoldingSet lookup.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24Don't try to preserve pointer types in SCEVConstants; the old codeDan Gohman
was over-complicated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24Make the trunc code consistent with the zext and sext code in itsDan Gohman
handling of pointer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106757 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22Replace ScalarEvolution's private copy of getLoopPredecessorDan Gohman
with LoopInfo's public copy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106603 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22Allow "exhaustive" trip count evaluation on phi nodes with allDan Gohman
constant operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-21Use A.append(...) instead of A.insert(A.end(), ...) when A is aDan Gohman
SmallVector, and other SmallVector simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19Fix ScalarEvolution's "exhaustive" trip count evaluation code to avoidDan Gohman
assuming that loops are in canonical form, as ScalarEvolution doesn't depend on LoopSimplify itself. Also, with indirectbr not all loops can be simplified. This fixes PR7416. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18Revert r106304 (105548 and friends), which are the SCEVComplexityCompareDan Gohman
optimizations. There is still some nondeterminism remaining. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18Reapply 105540, 105542, and 105548, and revert r105732.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18Reapply 105546.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106302 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18Reapply 105544.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18Remove getIntegerSCEV; it's redundant with getConstant, and getConstantDan Gohman
is more consistent with the ConstantInt API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Simplify this code.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106254 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping.Evan Cheng
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07The FoldingSet hash data includes pointer values, so it isn'tDan Gohman
determinstic. Instead, give SCEV objects an arbitrary sequence number. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105548 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07Optimize this code somewhat by taking advantage of the factDan Gohman
that the operands are sorted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07Micro-optimize this, to speed up this hotspot in debug builds a little.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07Micro-optimize this.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't goDan Gohman
scrounging through SCEVUnknown contents and SCEVNAryExpr operands; instead just do a simple deterministic comparison of the precomputed hash data. Also, since this is more precise, it eliminates the need for the slow N^2 duplicate detection code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28ConstantFoldConstantExpression can theoretically return null.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04Use the SCEVAddRecExpr::getPostIncExpr utility function insteadDan Gohman
of doing the same thing manually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04Fix a copy+pasto.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03Use getConstant instead of getIntegerSCEV. The two are basically theDan Gohman
same, now that getConstant has overloads consistent with ConstantInt::get. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03Silence warnings about -1 being converted to an unsigned value.Dan Gohman
Also, pass true for isSigned even when creating constants for unsigned comparisons, because the point is to create an all-ones constant, rather than UINT64_MAX, even for integers wider than 64 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03Use isTrueWhenEqual and isFalseWhenEqual instead of assuming thatDan Gohman
SimplifyICmpOperands will simplify such cases to EQ or NE. This makes the correcntess of the code independent on SimplifyICmpOperands doing certain simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03In ScalarEvolution::print, don't bother printing out the SCEVs forDan Gohman
comparison instructions, since they aren't interesting, despite having integer result types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03In SimplifyICmpOperands, avoid needlessly swapping the operands in theDan Gohman
case where both are addrecs in unrelated loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03Factor out the new <= and >= analysis code into SimplifyICmpOperands.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30Set isSigned to true when creating an all-ones integer constant, evenDan Gohman
for unsigned purposes, so >64-bit integer values get a full all-ones value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102739 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30Silence compiler warnings.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24ScalarEvolution support for <= and >= loops.Dan Gohman
Also, generalize ScalarEvolutions's min and max recognition to handle some new forms of min and max that this change makes more common. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24Use SimplifyICmpOperands in isKnownPredicate too.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24Update isImpliedCond to use the new SimplifyICmpOperands utility.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24Add a new utility function SimplifyICmpOperands. Much of this code isDan Gohman
refactored out of ScalarEvolution::isImpliedCond, which will be updated to use this new utility routine soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23When it doesn't matter whether zero or sign extension is used,Dan Gohman
use ScalarEvolutions "any" extend function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22Don't attempt to analyze values which are obviously undef. This fixes someDan Gohman
assertion failures in extreme cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21Make ScalarEvolution::getConstant support pointer types, for consistencyDan Gohman
with ScalarEvolution's overall approach to pointer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16Fix SCEVCommutativeExpr::print to be robust in the case of improperDan Gohman
expression canonicalization. Its job is to print what's there, not to make judgements about it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101461 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15Make getPredecessorWithUniqueSuccessorForBB return the unique successorDan Gohman
in addition to the predecessor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14Add a comment.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13Teach ScalarEvolution to simplify smax and umax when it can proveDan Gohman
that one operand is always greater than another. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13Minor code micro-optimizations.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12Micro-optimize a few hot spots.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12Add fast paths to ScalarEvolution::getSizeOf and getOffsetOf, asDan Gohman
they're used a lot by getNodeForGEP, which can be called a lot. This speeds up -iv-users by around 15% on several testcases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12Generalize ScalarEvolution's PHI analysis to handle loops that don'tDan Gohman
have preheaders or dedicated exit blocks, as clients may not otherwise need to run LoopSimplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12Rewrite the overflow checking in the get{Signed,Unsigned}Range code forDan Gohman
AddRecs so that it checks for overflow in the computation that it is performing, rather than just checking hasNo{Signed,Unsigned}Wrap, since those flags are for a different computation. This fixes a bug that impacts an upcoming change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101028 91177308-0d34-0410-b5e6-96231b3b80d8