summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the EliminateIVUsers call back out to its original location. Now thatDan Gohman2010-04-121-10/+4
| | | | | | | | a ScalarEvolution bug with overflow handling is fixed, the normal analysis code will automatically decline to operate on the icmp instructions which are responsible for the loop exit. llvm-svn: 101032
* Use RecursivelyDeleteTriviallyDeadInstructions in EliminateIVComparisons,Dan Gohman2010-04-121-3/+12
| | | | | | | | instead of deleting just the user. This makes it more consistent with other code in IndVarSimplify, and theoretically can eliminate more users earlier. llvm-svn: 101027
* Re-apply r101000, with a fix: Don't eliminate an icmp which is part ofDan Gohman2010-04-121-1/+45
| | | | | | | | the loop exit test. This usually doesn't come up for a variety of reasons, but it isn't impossible, so make IndVarSimplify handle it conservatively. llvm-svn: 101008
* Revert 101000, which is breaking self-host builds.Dan Gohman2010-04-121-38/+0
| | | | llvm-svn: 101002
* Teach IndVarSimplify how to eliminate comparisons involving inductionDan Gohman2010-04-111-0/+38
| | | | | | | | | | | | | variables. For example, with code like this: for (i=0;i<n;++i) if (i<n) x[i] = 0; IndVarSimplify will now recognize that i is always less than n inside the loop, and eliminate the if. llvm-svn: 101000
* Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasiseDan Gohman2010-04-111-1/+1
| | | | | | | that it's only testing for the entry condition, not full loop-invariant conditions. llvm-svn: 100979
* Generalize IVUsers to track arbitrary expressions rather than expressionsDan Gohman2010-04-071-2/+41
| | | | | | | | | | | | | | | 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. llvm-svn: 100699
* require that the branch being controlled by the IV Chris Lattner2010-04-031-2/+9
| | | | | | | | exits the loop. With this information we can guarantee the iteration count of the loop is bounded by the compare. I think this xforms is finally safe now. llvm-svn: 100285
* add integer overflow check for the fp induction variable Chris Lattner2010-04-031-16/+83
| | | | | | | | | | | | checker. Amusingly, we already had tests that we should have rejects because they would be miscompiled in the testsuite. The remaining issue with this is that we don't check that the branch causes us to exit the loop if it fails, so we don't actually know if we remain in bounds. llvm-svn: 100284
* add a comment and fix some consistency issues, convertingChris Lattner2010-04-031-15/+25
| | | | | | | | | to a signed vs unsigned value depending on the sign of the constant fp means that we can't distinguish between a truly negative number and a positive number so large the 32nd bit is set. So, do don't this! llvm-svn: 100283
* fix PR6761, a miscompilation due to the fp->int IV conversionChris Lattner2010-04-031-2/+2
| | | | | | stuff. More bugs remain though. llvm-svn: 100282
* just eliminate the uitofp checks. This code isn't doingChris Lattner2010-04-031-26/+5
| | | | | | | the required validity checks in the first place, and supporting a condition large enough to require the 32'nd bit isn't worth it. llvm-svn: 100280
* rename PH -> PN to be consistent with WeakPN and the restChris Lattner2010-04-031-20/+20
| | | | | | of llvm. llvm-svn: 100276
* improve comment and drop a dead check. If PH hadChris Lattner2010-04-031-4/+8
| | | | | | | no uses, it would have been deleted by RecursivelyDeleteTriviallyDeadInstructions llvm-svn: 100275
* strength reduce a ridiculous use of APInt.Chris Lattner2010-04-031-2/+1
| | | | llvm-svn: 100274
* rename stuff improve comment grammar.Chris Lattner2010-04-031-22/+21
| | | | llvm-svn: 100273
* simplify some code and resolve a fixme.Chris Lattner2010-04-031-4/+2
| | | | llvm-svn: 100272
* There is no guarantee that the increment and the branchChris Lattner2010-04-031-41/+28
| | | | | | | | | are in the same block. Insert the new increment in the correct location. Also, more cleanups. llvm-svn: 100271
* first half of a pass through IndVarSimplify::HandleFloatingPointIV,Chris Lattner2010-04-031-47/+35
| | | | | | | | this cleans up a bunch of code and also fixes several crashes and miscompiles. More to come unfortunately, this optimization is quite broken. llvm-svn: 100270
* Manually notify ScalarEvolution before making an operand replacement, sinceDan Gohman2010-04-021-0/+7
| | | | | | it can't currently observe such changes automatically. llvm-svn: 100186
* Skip debugging intrinsics when sinking unused invariants.Bill Wendling2010-03-231-10/+24
| | | | llvm-svn: 99324
* Clear the SCEVExpander's insertion point after making deletions,Dan Gohman2010-03-201-0/+4
| | | | | | | | | | | | | | so that the SCEVExpander doesn't retain a dangling pointer as its insert position. The dangling pointer in this case wasn't ever used to insert new instructions, but it was causing trouble with SCEVExpander's code for automatically advancing its insert position past debug intrinsics. This fixes use-after-free errors that valgrind noticed in test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll and test/Transforms/IndVarSimplify/exit_value_tests.ll. llvm-svn: 99036
* Skip debug info intrinsics.Devang Patel2010-03-151-0/+4
| | | | llvm-svn: 98584
* Add a DominatorTree argument to isLCSSA so that it doesn't have toDan Gohman2010-03-101-2/+2
| | | | | | | compute a set of reachable blocks for itself each time it is called, which is fairly frequently. llvm-svn: 98179
* Spelling fixes.Dan Gohman2010-03-011-6/+6
| | | | llvm-svn: 97453
* Make LoopSimplify change conditional branches in loop exiting blocksDan Gohman2010-02-251-12/+17
| | | | | | | | | | | | which branch on undef to branch on a boolean constant for the edge exiting the loop. This helps ScalarEvolution compute trip counts for loops. Teach ScalarEvolution to recognize single-value PHIs, when safe, and ForgetSymbolicName to forget such single-value PHI nodes as apprpriate in ForgetSymbolicName. llvm-svn: 97126
* Remove unused variables and parameters.Dan Gohman2010-02-221-9/+5
| | | | llvm-svn: 96780
* This cast<Instruction> is unnecessary.Dan Gohman2010-02-221-1/+1
| | | | llvm-svn: 96771
* recommit 96626, evidence that it broke things appearsDale Johannesen2010-02-191-0/+7
| | | | | | to be spurious llvm-svn: 96662
* Revert 96626, which causes build failure on ppc Darwin.Dale Johannesen2010-02-191-7/+0
| | | | llvm-svn: 96653
* Indvars needs to explicitly notify ScalarEvolution when it is replacingDan Gohman2010-02-181-0/+7
| | | | | | | | a loop exit value, so that if a loop gets deleted, ScalarEvolution isn't stick holding on to dangling SCEVAddRecExprs for that loop. This fixes PR6339. llvm-svn: 96626
* Hoist this loop-invariant logic out of the loop.Dan Gohman2010-02-181-4/+6
| | | | llvm-svn: 96614
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-2/+2
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Reapply the new LoopStrengthReduction code, with compile time andDan Gohman2010-02-121-74/+60
| | | | | | | | | | 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. llvm-svn: 95975
* Fix "the the" and similar typos.Dan Gohman2010-02-101-1/+1
| | | | llvm-svn: 95781
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-211-4/+10
| | | | | | | | | | | | | | 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. llvm-svn: 94061
* Set Changed properly after calling DeleteDeadPHIs.Dan Gohman2010-01-051-1/+1
| | | | llvm-svn: 92735
* Change errs() to dbgs().David Greene2010-01-051-4/+4
| | | | llvm-svn: 92609
* Add Loop contains utility methods for testing whether a loopDan Gohman2009-12-181-1/+1
| | | | | | | | contains another loop, or an instruction. The loop form is substantially more efficient on large loops than the typical code it replaces. llvm-svn: 91654
* Update various Loop optimization passes to cope with the possibility thatDan Gohman2009-11-051-1/+3
| | | | | | LoopSimplify form may not be available. llvm-svn: 86175
* Rename forgetLoopBackedgeTakenCount to forgetLoop, because itDan Gohman2009-10-311-1/+1
| | | | | | clears out more information than just the stored backedge taken count. llvm-svn: 85664
* Factor out redundancy from clone() implementations.Devang Patel2009-10-271-1/+1
| | | | llvm-svn: 85327
* Instruction::clone does not need to take an LLVMContext&. Remove that andNick Lewycky2009-09-271-1/+1
| | | | | | update all the callers. llvm-svn: 82889
* eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861Chris Lattner2009-09-021-2/+1
| | | | llvm-svn: 80766
* Special-case static allocas in IndVarSimplify's loop invariantDan Gohman2009-08-251-0/+5
| | | | | | | | sinking code, since they are special. If the loop preheader happens to be the entry block of a function, don't sink static allocas out of it. This fixes PR4775. llvm-svn: 80010
* eliminate the "Value" printing methods that print to a std::ostream.Chris Lattner2009-08-231-11/+12
| | | | | | This required converting a bunch of stuff off DOUT and other cleanups. llvm-svn: 79819
* Fix debug output to include a newline after printing a Value, nowDan Gohman2009-08-171-4/+4
| | | | | | that Value's operator<< doesn't include one. llvm-svn: 79240
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-7/+11
| | | | llvm-svn: 78948
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-3/+1
| | | | llvm-svn: 77635
* Remove Value::getName{Start,End}, the last of the old Name APIs.Daniel Dunbar2009-07-261-1/+1
| | | | llvm-svn: 77152
OpenPOWER on IntegriCloud