summaryrefslogtreecommitdiff
path: root/lib/Analysis/IVUsers.cpp
Commit message (Collapse)AuthorAge
* Slightly more useful tracing.Andrew Trick2011-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141867 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach IVUsers to stop at non-affine expressions unless they are bothDan Gohman2011-07-01
| | | | | | | | | | | | | | | | | | outside the loop and reducible. This more completely hides them from LSR, which isn't usually able to do anything meaningful with non-affine expressions anyway, and this consequently hides them from SCEVExpander, which is acutely unprepared for non-affine expressions. Replace test/CodeGen/X86/lsr-nonaffine.ll with a new test that tests the new behavior. This works around the bug in PR10117 / rdar://problem/9633149, and is generally an improvement besides. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134268 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars --disable-iv-rewrite: sever ties with IVUsers.Andrew Trick2011-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133988 91177308-0d34-0410-b5e6-96231b3b80d8
* IVUsers no longer needs to record the phis.Andrew Trick2011-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133518 91177308-0d34-0410-b5e6-96231b3b80d8
* Update this comment.Dan Gohman2011-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132202 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.Andrew Trick2011-05-20
| | | | | | | | | | | No functionality enabled by default. Use -disable-iv-rewrite. Extended IVUsers to keep track of the phi that represents the users' IV. Added the WidenIV transform to replace a narrow IV with a wide IV by doing a one-for-one replacement of IV users instead of expanding the SCEV expressions. [sz]exts are removed and truncs are inserted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131744 91177308-0d34-0410-b5e6-96231b3b80d8
* indvars: Added DisableIVRewrite and WidenIVs.Andrew Trick2011-05-04
| | | | | | | | | This adds functionality to remove size/zero extension during indvars without generating a canonical IV and rewriting all IV users. It's disabled by default so should have no effect on codegen. Work in progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130829 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid creating canonical induction variables for non-native types.Andrew Trick2011-03-18
| | | | | | | | | For example, on 32-bit architecture, don't promote all uses of the IV to 64-bits just because one use is a 64-bit cast. Alternate implementation of the patch by Arnaud de Grandmaison. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127884 91177308-0d34-0410-b5e6-96231b3b80d8
* split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner2011-01-02
| | | | | | | | so that Dominators.h is *just* domtree. Also prune #includes a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-19
| | | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-12
| | | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116334 91177308-0d34-0410-b5e6-96231b3b80d8
* Now with fewer extraneous semicolons!Owen Anderson2010-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
* stop forcing a noop AssemblyAnnotationWriter to silence #usesChris Lattner2010-09-02
| | | | | | | comments, these don't happen anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112901 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 112442 and 112440 until the compile time problems introducedDan Gohman2010-09-01
| | | | | | | by 112440 are resolved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112692 91177308-0d34-0410-b5e6-96231b3b80d8
* Make IVUsers iterative instead of recursive.Dan Gohman2010-08-29
| | | | | | | | This has the side effect of reversing the order of most of IVUser's results. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112442 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak IVUsers' concept of "interesting" to exclude add recurrencesDan Gohman2010-08-17
| | | | | | | | | | where the step value is an induction variable from an outer loop, to avoid trouble trying to re-expand such expressions. This effectively hides such expressions from indvars and lsr, which prevents them from getting into trouble. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111317 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r110396 to fix buildbots.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-05
| | | | | | | | | 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
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the Expr member from IVUsers. Instead of remembering the expression,Dan Gohman2010-04-19
| | | | | | | | just ask ScalarEvolution for it on demand. This helps IVUsers be more robust in the case of expressions changing underneath it. This fixes PR6862. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101819 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a cast to void to show that the return value is beingDan Gohman2010-04-11
| | | | | | | intentionally ignored. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100984 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete a dead check.Dan Gohman2010-04-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100983 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete dead code.Dan Gohman2010-04-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100981 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in IVUsers which was permitting non-affine addrecs toDan Gohman2010-04-09
| | | | | | | be sent to LSR, which it isn't prepared to handle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100839 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize IVUsers to track arbitrary expressions rather than expressionsDan Gohman2010-04-07
| | | | | | | | | | | | | | | | explicitly split into stride-and-offset pairs. Also, add the ability to track multiple post-increment loops on the same expression. This refines the concept of "normalizing" SCEV expressions used for to post-increment uses, and introduces a dedicated utility routine for normalizing and denormalizing expressions. This fixes the expansion of expressions which are post-increment users of more than one loop at a time. More broadly, this takes LSR another step closer to being able to reason about more than one loop at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100699 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a const qualifier.Dan Gohman2010-04-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100515 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling fixes.Dan Gohman2010-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97453 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variables and parameters.Dan Gohman2010-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96780 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify this code; no need for a custom subclass if it doesn't needDan Gohman2010-02-14
| | | | | | | to override anything from the parent class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96150 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply the new LoopStrengthReduction code, with compile time andDan Gohman2010-02-12
| | | | | | | | | | | bug fixes, and with improved heuristics for analyzing foreign-loop addrecs. This change also flattens IVUsers, eliminating the stride-oriented groupings, which makes it easier to work with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
* Use an AssemblyAnnotatorWriter to clean up IVUsers' debug output.Dan Gohman2010-02-10
| | | | | | | The "uses=" comments are just clutter in this context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95799 91177308-0d34-0410-b5e6-96231b3b80d8
* Add "dump" method to IVUsersOneStride.Bill Wendling2010-02-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95022 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-21
| | | | | | | | | | | | | | | This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94061 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new helper function to IVUsers for returning the "canonical"Dan Gohman2010-01-19
| | | | | | | | | form of an expression. This is the expression without the post-increment adjustment made, which is useful in determining which registers will be used by the expansion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93921 91177308-0d34-0410-b5e6-96231b3b80d8
* Use WriteAsOperand instead of getName() to print loop header names,Dan Gohman2010-01-09
| | | | | | | so that unnamed blocks are handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93059 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert debug messages to use dbgs(). Generally this meansDavid Greene2009-12-23
| | | | | | | s/errs/dbgs/g except for certain special cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92037 91177308-0d34-0410-b5e6-96231b3b80d8
* Add Loop contains utility methods for testing whether a loopDan Gohman2009-12-18
| | | | | | | | | contains another loop, or an instruction. The loop form is substantially more efficient on large loops than the typical code it replaces. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91654 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply LoopStrengthReduce and IVUsers cleanups, excluding the partDan Gohman2009-12-18
| | | | | | | | | of 91296 that caused trouble -- the Processed list needs to be preserved for the livetime of the pass, as AddUsersIfInteresting is called from other passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91641 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently ↵Evan Cheng2009-12-17
| | | | | | introduced a non-deterministic behavior in the optimizer somewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91598 91177308-0d34-0410-b5e6-96231b3b80d8
* Clear the Processed set when it is no longer used, and clear theDan Gohman2009-12-14
| | | | | | | IVUses list in releaseMemory(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91296 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so theDan Gohman2009-12-14
| | | | | | | condition was inverted when the code was converted to contains(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91295 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop Loop::isNotAlreadyContainedIn in favor of Loop::contains. TheDan Gohman2009-12-14
| | | | | | | former was just exposing a LoopInfoBase implementation detail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91286 91177308-0d34-0410-b5e6-96231b3b80d8
* enable iv-users simplification by defaultJim Grosbach2009-11-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89713 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach IVUsers to keep things simpler and track loop-invariant strides onlyJim Grosbach2009-11-19
| | | | | | | for uses inside the loop. This works better with LSR. Disabled behind -simplify-iv-users while benchmarking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89299 91177308-0d34-0410-b5e6-96231b3b80d8
* - Teach LSR to avoid changing cmp iv stride if it will create an immediate thatEvan Cheng2009-11-12
| | | | | | | | | | | | | | | cannot be folded into target cmp instruction. - Avoid a phase ordering issue where early cmp optimization would prevent the later count-to-zero optimization. - Add missing checks which could cause LSR to reuse stride that does not have users. - Fix a bug in count-to-zero optimization code which failed to find the pre-inc iv's phi node. - Remove, tighten, loosen some incorrect checks disable valid transformations. - Quite a bit of code clean up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86969 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix IVUsers to avoid assuming that the loop has a unique backedge.Dan Gohman2009-11-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86161 91177308-0d34-0410-b5e6-96231b3b80d8
* Instead of testing whether an instruction dominates the loop preheader,Dan Gohman2009-09-27
| | | | | | | | | | test whether it properly dominates the loop header. This is equivalent when the loop has a preheader, and has the advantage of working when the loop doesn't have a preheader. Since IVUsers doesn't Require LoopSimplify, the loop isn't guaranteed to have a preheader. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82899 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a redundant #include.Dan Gohman2009-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82897 91177308-0d34-0410-b5e6-96231b3b80d8
* remove a few dead insertion methods.Chris Lattner2009-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79882 91177308-0d34-0410-b5e6-96231b3b80d8