summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* indvars -disable-iv-rewrite: ExprToMap lives in Pass data, so be moreAndrew Trick2011-07-061-1/+2
| | | | | | careful about referencing values. llvm-svn: 134537
* indvars -disable-iv-rewrite: Added SimplifyCongruentIVs.Andrew Trick2011-07-061-1/+58
| | | | llvm-svn: 134530
* Preserve debug loc.Devang Patel2011-07-051-1/+1
| | | | llvm-svn: 134441
* indvars -disable-iv-rewrite: avoid multiple IVs in weird cases.Andrew Trick2011-07-051-18/+30
| | | | | | Putting back the helper that I removed on 7/1 to do this right. llvm-svn: 134423
* indvars -disable-iv-rewrite: bug fix involving weird geps and related cleanup.Andrew Trick2011-07-021-46/+51
| | | | llvm-svn: 134306
* indvars -disable-iv-rewrite: handle cloning binary operators that cannot ↵Andrew Trick2011-06-301-3/+7
| | | | | | overflow. llvm-svn: 134177
* indvars -disable-iv-rewrite: handle an edge case involving identity phis.Andrew Trick2011-06-301-3/+8
| | | | llvm-svn: 134124
* indvars -disable-iv-rewrite: insert new trunc instructions carefully.Andrew Trick2011-06-291-13/+21
| | | | llvm-svn: 134112
* indvars -disable-iv-rewrite: just because SCEV ignores casts doesn'tAndrew Trick2011-06-291-0/+1
| | | | | | mean they can be removed. llvm-svn: 134054
* cleanup: misleading comment.Andrew Trick2011-06-281-2/+2
| | | | llvm-svn: 134010
* SCEVExpander: give new insts a name that identifies the reponsible pass.Andrew Trick2011-06-281-1/+1
| | | | llvm-svn: 133992
* indvars --disable-iv-rewrite: sever ties with IVUsers.Andrew Trick2011-06-281-6/+6
| | | | llvm-svn: 133988
* indvars --disable-iv-rewrite: Defer evaluating s/zext until SCEVAndrew Trick2011-06-281-40/+57
| | | | | | evaluates all other IV exprs. llvm-svn: 133982
* indvars -disable-iv-rewrite: run RLEV after SimplifyIVUsers forAndrew Trick2011-06-271-4/+6
| | | | | | a bit more control over the order SCEVs are evaluated. llvm-svn: 133959
* Set debug loc.Devang Patel2011-06-221-0/+2
| | | | llvm-svn: 133636
* IVUsers no longer needs to record the phis.Andrew Trick2011-06-211-10/+7
| | | | llvm-svn: 133518
* indvars -disable-iv-rewrite: Adds support for eliminating identityAndrew Trick2011-06-211-100/+237
| | | | | | | | | | | | | | | | | | | ops. This is a rewrite of the IV simplification algorithm used by -disable-iv-rewrite. To avoid perturbing the default mode, I temporarily split the driver and created SimplifyIVUsersNoRewrite. The idea is to avoid doing opcode/pattern matching inside IndVarSimplify. SCEV already does it. We want to optimize with the full generality of SCEV, but optimize def-use chains top down on-demand rather than rewriting the entire expression bottom-up. This was easy to do for operations that SCEV can prove are identity function. So we're now eliminating bitmasks and zero extends this way. A result of this rewrite is that indvars -disable-iv-rewrite no longer requires IVUsers. llvm-svn: 133502
* indvars: incremental fixes for -disable-iv-rewrite and testcases.Andrew Trick2011-05-261-21/+72
| | | | | | | | Use a proper worklist for use-def traversal without holding onto an iterator. Now that we process all IV uses, we need complete logic for resusing existing derived IV defs. See HoistStep. llvm-svn: 132103
* indvars: fixed IV cloning in -disable-iv-rewrite mode with associatedAndrew Trick2011-05-251-52/+114
| | | | | | cleanup and overdue test cases. llvm-svn: 132038
* indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.Andrew Trick2011-05-201-102/+352
| | | | | | | | | | 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. llvm-svn: 131744
* indvars: minor cleanup in preparation for sign/zero extend elimination.Andrew Trick2011-05-201-18/+11
| | | | llvm-svn: 131716
* Convert SimplifyIVUsers into a worklist instead of a single pass overAndrew Trick2011-05-131-1/+1
| | | | | | the users. llvm-svn: 131277
* indvars: Added SimplifyIVUsers.Andrew Trick2011-05-121-85/+99
| | | | | | | Interleave IV simplifications. Currently involves EliminateComparison and EliminateRemainder. Next I'll add EliminateExtend. llvm-svn: 131210
* indvars: Added DisableIVRewrite and WidenIVs.Andrew Trick2011-05-041-9/+115
| | | | | | | | 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. llvm-svn: 130829
* indvars: Added canExpandBackEdgeTakenCount.Andrew Trick2011-05-031-32/+55
| | | | | | | | | Only create a canonical IV for backedge taken count if it will actually be used by LinearFunctionTestReplace. And some related cleanup, preparing to reduce dependence on canonical IVs. No significant effect on x86 or arm in the test-suite. llvm-svn: 130799
* Reapply r130340: Fix for PR9730.Andrew Trick2011-04-281-1/+1
| | | | llvm-svn: 130408
* Reverting r130340 in the unlikely event that it's responsible for a llvm-gcc ↵Andrew Trick2011-04-281-1/+1
| | | | | | stage2 compiler error. llvm-svn: 130350
* Fixes PR9730: indvars: An asserting value handle still pointed to this valueAndrew Trick2011-04-271-1/+1
| | | | | | | | | Modified LinearFunctionTestReplace to push the condition on the dead list instead of eagerly deleting it. This can cause unnecessary IV rewrites, which should have no effect on codegen and will not be an issue once we stop generating canonical IVs. llvm-svn: 130340
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-2/+1
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-301-0/+1
| | | | llvm-svn: 128535
* Remove TargetData and ValueTracking includes. I didn't mean for them to ↵Andrew Trick2011-03-181-4/+0
| | | | | | sneak in my last checkin. llvm-svn: 127842
* Added isValidRewrite() to check the result of ScalarEvolutionExpander.Andrew Trick2011-03-171-37/+82
| | | | | | | | | SCEV may generate expressions composed of multiple pointers, which can lead to invalid GEP expansion. Until we can teach SCEV to follow strict pointer rules, make sure no bad GEPs creep into IR. Fixes rdar://problem/9038671. llvm-svn: 127839
* whitespaceAndrew Trick2011-03-171-18/+18
| | | | llvm-svn: 127837
* reduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec'sChris Lattner2011-01-091-3/+2
| | | | | | that have the bit set. llvm-svn: 123104
* Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be memberDan Gohman2010-11-171-10/+10
| | | | | | | functions of ScalarEvolution, in preparation for memoization and other optimizations. llvm-svn: 119562
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | 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. llvm-svn: 116820
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+9
| | | | | | | | | 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. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* do not rely on the implicit-dereference semantics of dyn_cast_or_nullGabor Greif2010-09-181-4/+4
| | | | llvm-svn: 114277
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* mass elimination of reliance on automatic iterator dereferencingGabor Greif2010-07-221-2/+2
| | | | llvm-svn: 109103
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | llvm-svn: 109045
* Remember that the induction variable is always a PHINode andDan Gohman2010-07-201-4/+4
| | | | | | | use getIncomingValueForBlock instead of LoopInfo::getCanonicalInductionVariableIncrement. llvm-svn: 108865
* cache result of operator*Gabor Greif2010-07-091-2/+3
| | | | llvm-svn: 107976
* Disable indvars on loops when LoopSimplify form is not available.Dan Gohman2010-06-181-0/+11
| | | | | | This fixes PR7333. llvm-svn: 106267
* Use getConstant instead of getIntegerSCEV. The two are basically theDan Gohman2010-05-031-6/+6
| | | | | | same, now that getConstant has overloads consistent with ConstantInt::get. llvm-svn: 102965
* Teach IndVarSimplify how to eliminate remainder operators where theDan Gohman2010-04-131-0/+71
| | | | | | | | | | | | numerator is an induction variable. For example, with code like this: for (i=0;i<n;++i) x[i%n] = 0; IndVarSimplify will now recognize that i is always less than n inside the loop, and eliminate the remainder. llvm-svn: 101113
* Suppress LinearFunctionTestReplace when the computed backedge-takenDan Gohman2010-04-121-0/+18
| | | | | | | | | | | | expression is a UDiv and it doesn't appear that the UDiv came from the user's source. ScalarEvolution has recently figured out how to compute a tripcount expression for the inner loop in SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a udiv instruction dramatically slows down the enclosing loop. llvm-svn: 101068
OpenPOWER on IntegriCloud