summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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
OpenPOWER on IntegriCloud