summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Various comment fixes.Dan Gohman2009-05-241-9/+14
| | | | llvm-svn: 72376
* Change ScalarEvolution::getSCEVAtScope to always return the original valueDan Gohman2009-05-241-21/+8
| | | | | | | | in the case where a loop exit value cannot be computed, instead of only in some cases while using SCEVCouldNotCompute in others. This simplifies getSCEVAtScope's callers. llvm-svn: 72375
* Teach SCEV::isLoopInvariant and SCEV::hasComputableLoopEvolutionDan Gohman2009-05-201-2/+6
| | | | | | | about the convention from LoopInfo that a null Loop* means the entire function body. llvm-svn: 72152
* Make SCEVCallbackVH a private nested class inside ScalarEvolution, asDan Gohman2009-05-191-3/+3
| | | | | | it's an implementation detail. llvm-svn: 72122
* Teach SCEVExpander to expand arithmetic involving pointers into GEPDan Gohman2009-05-191-0/+7
| | | | | | | | | | | | | | | | instructions. It attempts to create high-level multi-operand GEPs, though in cases where this isn't possible it falls back to casting the pointer to i8* and emitting a GEP with that. Using GEP instructions instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that don't use ScalarEvolution, such as BasicAliasAnalysis. Also, make the AddrModeMatcher more aggressive in handling GEPs. Previously it assumed that operand 0 of a GEP would require a register in almost all cases. It now does extra checking and can do more matching if operand 0 of the GEP is foldable. This fixes a problem that was exposed by SCEVExpander using GEPs. llvm-svn: 72093
* Silence Release-Asserts warnings.Daniel Dunbar2009-05-181-0/+1
| | | | llvm-svn: 72011
* Teach ScalarEvolution to recognize x^-1 in the case where non-demandedDan Gohman2009-05-181-0/+13
| | | | | | bits have been stripped out by instcombine. llvm-svn: 72010
* Delete a redundant 'else'.Dan Gohman2009-05-181-1/+1
| | | | llvm-svn: 72009
* Fix ScalarEvolution::isLoopGuardedByCond to accept a null Loop*, forDan Gohman2009-05-181-0/+4
| | | | | | | consistency with other routines that use a null Loop* to mean code not contained by any loop. llvm-svn: 72008
* Minor code cleanups. Do more of the work before the if statementsDan Gohman2009-05-181-16/+21
| | | | | | instead of within their controlling expressions. llvm-svn: 72007
* Add assertion checks to the SCEV operator creation methods to catchDan Gohman2009-05-181-0/+34
| | | | | | type mismatches. llvm-svn: 72006
* Make ScalarEvolution::isLoopGuardedByCond work even when the edgeDan Gohman2009-05-181-13/+27
| | | | | | entering a loop is a non-split critical edge. llvm-svn: 72004
* Add an isOne() utility function to ScalarEvolution, similar to isZero()Dan Gohman2009-05-181-1/+6
| | | | | | and similar to ConstantInt's isOne(). llvm-svn: 72003
* Add three new helper routines, getNoopOrZeroExtend,Dan Gohman2009-05-131-0/+47
| | | | | | | | | getNoopOrSignExtend, and getTruncateOrNoop. These are similar to getTruncateOrZeroExtend etc., except that they assert that the conversion is either not widening or narrowing, as appropriate. These will be used in some upcoming fixes. llvm-svn: 71632
* When forgetting SCEVs for loop PHIs, don't forget SCEVUnknown values.Dan Gohman2009-05-121-2/+12
| | | | | | | | | These values aren't analyzable, so they don't care if more information about the loop trip count can be had. Also, SCEVUnknown is used for a PHI while the PHI itself is being analyzed, so it needs to be left in the Scalars map. This fixes a variety of subtle issues. llvm-svn: 71533
* Fix GetMinTrailingZeros for SCEVSignExtend and SCEVZeroExtendExpr toDan Gohman2009-05-121-2/+2
| | | | | | | | | | return the correct value when the cast operand is all zeros. This ought to be pretty rare, because it would mean that the regular SCEV folding routines missed a case, though there are cases they might legitimately miss. Also, it's unlikely anything currently using GetMinTrailingZeros cares about this case. llvm-svn: 71532
* Allow scalar evolution to compute iteration counts for loops with a Eli Friedman2009-05-091-19/+8
| | | | | | pointer-based condition. This fixes PR3171. llvm-svn: 71354
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-091-1/+1
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.Dan Gohman2009-05-091-0/+3
| | | | llvm-svn: 71302
* Fix bogus overflow checks by replacing them with actualDan Gohman2009-05-081-7/+18
| | | | | | overflow checks. llvm-svn: 71284
* Fold trunc casts into add-recurrence expressions, allowing theDan Gohman2009-05-081-8/+62
| | | | | | | add-recurrence to be exposed. Add a new SCEV folding rule to help simplify expressions in the presence of these extra truncs. llvm-svn: 71264
* Fix another bug in r71252. This code supports GetElementPtrDan Gohman2009-05-081-2/+2
| | | | | | constant exprs as well as instructions. llvm-svn: 71262
* Add memoization for getSCEVAtScope results for instructionsDan Gohman2009-05-081-0/+15
| | | | | | | | | which are not analyzed with SCEV techniques, which can require brute-forcing through a large number of instructions. This fixes a massive compile-time issue on 400.perlbench (in particular, the loop in MD5Transform). llvm-svn: 71259
* Make the SCEV* form of getSCEVAtScope public, to allow ScalarEvolutionDan Gohman2009-05-081-13/+12
| | | | | | clients to use it. llvm-svn: 71258
* Fix an error from r71252.Dan Gohman2009-05-081-4/+4
| | | | llvm-svn: 71255
* Factor out the code for creating SCEVs for GEPs into aDan Gohman2009-05-081-33/+40
| | | | | | separate function. llvm-svn: 71252
* Implement several new SCEV folding rules for UDiv SCEVs.Dan Gohman2009-05-081-2/+54
| | | | | | This fixes an old FIXME, and is needed by some upcoming changes. llvm-svn: 71247
* SCEVComplexityCompare's new code was missing SCEVUDivExpr. ImplementDan Gohman2009-05-071-0/+14
| | | | | | the SCEVUDivExpr case. llvm-svn: 71173
* Make ScalarEvolution's GroupByComplexity more thorough. In additionDan Gohman2009-05-071-9/+85
| | | | | | | | to sorting SCEVs by their kind, sort SCEVs of the same kind according to their operands. This helps avoid things like (a+b) being a distinct expression from (b+a). llvm-svn: 71160
* Trim unnecessary headers. Code in Analysis shouldn't use TransformsDan Gohman2009-05-071-3/+0
| | | | | | headers due to library dependencies. llvm-svn: 71159
* Factor out a common base class between SCEVCommutativeExpr andDan Gohman2009-05-071-10/+1
| | | | | | | SCEVAddRecExpr. This eliminates redundant code for visiting all the operands of an expression. llvm-svn: 71157
* Use stable_sort instead of plain sort to avoid the risk of generatingDan Gohman2009-05-061-1/+1
| | | | | | | trivially different code on different hosts (due to differing std::sort implementations). llvm-svn: 71124
* Re-apply 70645, converting ScalarEvolution to useDan Gohman2009-05-041-80/+114
| | | | | | | | | | | | CallbackVH, with fixes. allUsesReplacedWith need to walk the def-use chains and invalidate all users of a value that is replaced. SCEVs of users need to be recalcualted even if the new value is equivalent. Also, make forgetLoopPHIs walk def-use chains, since any SCEV that depends on a PHI should be recalculated when more information about that PHI becomes available. llvm-svn: 70927
* Fix an 80-column violation.Dan Gohman2009-05-041-1/+2
| | | | llvm-svn: 70925
* Fix doxygen comment syntax.Dan Gohman2009-05-041-1/+1
| | | | llvm-svn: 70924
* Constify a bunch of SCEV-using code.Dan Gohman2009-05-041-59/+61
| | | | llvm-svn: 70919
* Revert r70645 for now; it's causing a variety of regressions.Dan Gohman2009-05-031-25/+33
| | | | llvm-svn: 70661
* Convert ScalarEvolution to use CallbackVH for its internal map. ThisDan Gohman2009-05-021-33/+25
| | | | | | | | | makes ScalarEvolution::deleteValueFromRecords, and it's code that subtly needed to be called before ReplaceAllUsesWith, unnecessary. It also makes ValueDeletionListener unnecessary. llvm-svn: 70645
* When ScalarEvolution is told to forget the trip count for a loop, haveDan Gohman2009-05-021-3/+11
| | | | | | | it also forget any SCEVs associated with loop-header PHIs in the loop, as they may be dependent on trip count information. llvm-svn: 70633
* When printing a SCEVUnknown with pointer type, don't print anDan Gohman2009-05-011-4/+0
| | | | | | | | artificial "ptrtoint", as it tends to clutter up complicated expressions. The cast operators now print both source and destination types, which is usually sufficient. llvm-svn: 70554
* Fix an 80-column violation.Dan Gohman2009-05-011-1/+2
| | | | llvm-svn: 70550
* When creating cast scevs, canonicalize the destination type. ThisDan Gohman2009-05-011-0/+9
| | | | | | avoids duplicate scevs that differ only in type. llvm-svn: 70549
* hasSCEV() was declared in ScalarEvolution.h, but never defined. This must haveTorok Edwin2009-05-011-0/+6
| | | | | | gone lost during the pImpl conversion. llvm-svn: 70536
* Add some comments, and tidy up some whitespace.Dan Gohman2009-04-301-5/+7
| | | | llvm-svn: 70510
* Extend ScalarEvolution's getBackedgeTakenCount to be able toDan Gohman2009-04-301-65/+127
| | | | | | | | | | | | compute an upper-bound value for the trip count, in addition to the actual trip count. Use this to allow getZeroExtendExpr and getSignExtendExpr to fold casts in more cases. This may eventually morph into a more general value-range analysis capability; there are certainly plenty of places where more complete value-range information would allow more folding. llvm-svn: 70509
* Don't try to mix integers and pointers in an icmp instructionDan Gohman2009-04-301-12/+19
| | | | | | in getSCEVAtScope. llvm-svn: 70495
* Fix ScalarEvolution::print to print a value for any Instruction withDan Gohman2009-04-301-1/+1
| | | | | | a SCEVable type, not just integer types. llvm-svn: 70463
* Implement getSCEVAtScope for SCEV cast expressions.Dan Gohman2009-04-291-2/+25
| | | | llvm-svn: 70422
* Generalize the cast-of-addrec folding to handle folding of SCEVs likeDan Gohman2009-04-291-46/+33
| | | | | | | | (sext i8 {-128,+,1} to i64) to i64 {-128,+,1}, where the iteration crosses from negative to positive, but is still safe if the trip count is within range. llvm-svn: 70421
* Include the source type in SCEV cast expression debug output, andDan Gohman2009-04-291-3/+3
| | | | | | | print sext, zext, and trunc, instead of signextend, zeroextend, and truncate, respectively, for consistency with the main IR. llvm-svn: 70405
OpenPOWER on IntegriCloud