summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a really wrong comment.Dale Johannesen2008-12-031-1/+1
| | | | llvm-svn: 60494
* Minor rewrite per review feedback.Dale Johannesen2008-12-021-8/+7
| | | | llvm-svn: 60442
* Make the code do what the comment says it does.Dale Johannesen2008-12-021-4/+5
| | | | llvm-svn: 60431
* some random comment improvements.Chris Lattner2008-12-021-11/+22
| | | | llvm-svn: 60395
* Consider only references to an IV within the loop whenDale Johannesen2008-12-011-6/+26
| | | | | | | | | figuring out the base of the IV. This produces better code in the example. (Addresses use (IV) instead of (BASE,IV) - a significant improvement on low-register machines like x86). llvm-svn: 60374
* Introduce a new array_pod_sort function and switch LSR to use itChris Lattner2008-12-011-1/+1
| | | | | | | | | instead of std::sort. This shrinks the release-asserts LSR.o file by 1100 bytes of code on my system. We should start using array_pod_sort where possible. llvm-svn: 60335
* Eliminate use of setvector for the DeadInsts set, just use a smallvector.Chris Lattner2008-12-011-17/+31
| | | | | | This is a lot cheaper and conceptually simpler. llvm-svn: 60332
* DeleteTriviallyDeadInstructions is always passed theChris Lattner2008-12-011-10/+9
| | | | | | DeadInsts ivar, just use it directly. llvm-svn: 60330
* simplify DeleteTriviallyDeadInstructions again, unlike my previousChris Lattner2008-12-011-20/+13
| | | | | | | | buggy rewrite, this notifies ScalarEvolution of a pending instruction about to be removed and then erases it, instead of erasing it then notifying. llvm-svn: 60329
* Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc ↵Bill Wendling2008-11-291-20/+21
| | | | | | to fail. llvm-svn: 60233
* Simplify LoopStrengthReduce::DeleteTriviallyDeadInstructions byChris Lattner2008-11-271-21/+20
| | | | | | | making it use RecursivelyDeleteTriviallyDeadInstructions to do the heavy lifting. llvm-svn: 60195
* use continue to reduce indentationChris Lattner2008-11-271-18/+19
| | | | llvm-svn: 60192
* Change create*Pass factory functions to return Pass* instead ofDaniel Dunbar2008-10-221-1/+1
| | | | | | | | | | | LoopPass*. - Although less precise, this means they can be used in clients without RTTI (who would otherwise need to include LoopPass.h, which eventually includes things using dynamic_cast). This was the simplest solution that presented itself, but I am happy to use a better one if available. llvm-svn: 58010
* Call ScalarEvolution's deleteValueFromRecords before deleting anDan Gohman2008-10-011-3/+3
| | | | | | instruction, not after. This fixes some uses of free'd memory. llvm-svn: 56908
* Teach LSR to optimize away SMAX operations for tripcounts in commonDan Gohman2008-09-151-0/+127
| | | | | | | | | cases. See the comment above OptimizeSMax for the full story, and the testcase for an example. This cancels out a pessimization commonly attributed to indvars, and will allow us to lift some of the artificial throttles in indvars, rather than add new ones. llvm-svn: 56230
* fix overflow check.Devang Patel2008-09-091-2/+1
| | | | llvm-svn: 56011
* Remove unused counter.Devang Patel2008-09-081-1/+0
| | | | llvm-svn: 55924
* Remove OptimizeIVType()Devang Patel2008-09-081-206/+0
| | | | llvm-svn: 55913
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* Add additional check to ensure that iv is canonicalized.Devang Patel2008-09-031-0/+1
| | | | llvm-svn: 55682
* Check iteration count.Devang Patel2008-09-031-0/+4
| | | | llvm-svn: 55680
* While removing PHI, use basicblock to identify incoming value.Devang Patel2008-09-031-2/+3
| | | | llvm-svn: 55678
* If all IV uses are extending integer IV then change the type of IV itself, ↵Devang Patel2008-09-021-0/+201
| | | | | | if possible. llvm-svn: 55674
* Do not apply the transformation if the target does not support DestTy natively.Devang Patel2008-08-271-2/+9
| | | | llvm-svn: 55433
* Fix typos and whitespaces. Other cosmetic changes based on feedback.Devang Patel2008-08-271-12/+9
| | | | llvm-svn: 55424
* If IV is used in a int-to-float cast inside the loop then try to eliminate ↵Devang Patel2008-08-261-2/+118
| | | | | | the cast operation. llvm-svn: 55374
* Revert 54821. It's miscompiling 252.eon and 447.dealIIEvan Cheng2008-08-171-118/+1
| | | | llvm-svn: 54878
* Reapply 54786. Add overflow and number of mantissa bits checks.Devang Patel2008-08-151-1/+118
| | | | llvm-svn: 54821
* Revert 54786. It's not checking for overflows, etc.Evan Cheng2008-08-151-101/+0
| | | | llvm-svn: 54813
* If IV is used in a int-to-float cast inside the loop then try to eliminate ↵Devang Patel2008-08-141-0/+101
| | | | | | the cast opeation. llvm-svn: 54786
* Rename. s/FindIVForUser/FindIVUserForCond/gDevang Patel2008-08-131-4/+4
| | | | llvm-svn: 54754
* Check sign to detect overflow before changing compare stride.Devang Patel2008-08-131-1/+8
| | | | llvm-svn: 54710
* Fix PR2355: bug in ChangeCompareStride. When the loop termination compare is ↵Evan Cheng2008-08-061-2/+2
| | | | | | the only use of its iv stride, the stride can be eliminated by moving it to another stride. If the scale is negative, swap the predicate instead of using a inverse predicate. llvm-svn: 54415
* Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain thatDan Gohman2008-07-211-0/+5
| | | | | | | | | leads into a cycle involving a different PHI, LSR got stuck running around that cycle looking for the original PHI. To avoid this, keep track of visited PHIs and stop searching if we see one more than once. This fixes PR2570. llvm-svn: 53879
* Fix uninitialized use of the Changed variable.Dan Gohman2008-07-141-0/+2
| | | | llvm-svn: 53564
* Fix two serious LSR bugs.Evan Cheng2008-07-071-37/+37
| | | | | | | 1. LSR runOnLoop is always returning false regardless if any transformation is made. 2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed. llvm-svn: 53193
* Fix spelling and grammar in a comment.Dan Gohman2008-06-231-2/+2
| | | | llvm-svn: 52648
* Improve LSR's dead-phi detection to handle use-def cyclesDan Gohman2008-06-221-20/+17
| | | | | | with more than two nodes. llvm-svn: 52617
* Move LSR's private isZero function to a public SCEV memberDan Gohman2008-06-181-17/+7
| | | | | | function, and make use of it in several places. llvm-svn: 52463
* Refine the change in r52258 for avoiding use-before-def conditionsDan Gohman2008-06-161-9/+12
| | | | | | | | | when changing the stride of a comparison so that it's slightly more precise, by having it scan the instruction list to determine if there is a use of the condition after the point where the condition will be inserted. llvm-svn: 52371
* Switch over to SetVector to ensure same order of iterations do not vary ↵Evan Cheng2008-06-161-8/+9
| | | | | | across runs. llvm-svn: 52361
* Iterating over SmallPtrSet is not deterministic.Evan Cheng2008-06-161-6/+6
| | | | llvm-svn: 52339
* Protect ChangeCompareStride from situations in which it is possibleDan Gohman2008-06-131-3/+12
| | | | | | for it to generate use-before-def IR, such as in this testcase. llvm-svn: 52258
* op_iterator-ify some loops, fix 80col violationsGabor Greif2008-06-111-9/+11
| | | | llvm-svn: 52226
* Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into ↵Evan Cheng2008-05-241-5/+0
| | | | | | load and shuffle instructions. llvm-svn: 51521
* When LSR is replacing an instruction, callDan Gohman2008-05-211-7/+10
| | | | | | | | | | | | | | | | | | | | ScalarEvolution::deleteValueFromRecords on it before doing the replaceAllUsesWith, because ScalarEvolution looks at the instruction's users to find SCEV references to the instruction's SCEV object in its internal maps. Move all of LSR's loop-related state clearing after processing the loop and before cleaning up dead PHI nodes. This eliminates all of LSR's SCEV references just before the calls to ScalarEvolution::deleteValueFromRecords so that when ScalarEvolution drops its own SCEV references, the reference counts will reach zero and the SCEVs will be deleted immediately. These changes fix some compiler aborts involving ScalarEvolution holding onto and reusing SCEV objects for instructions that have been deleted. No regression test unfortunately; because the symptoms were due to dangling pointers, reduced testcases ended up being fairly arbitrary. llvm-svn: 51359
* Refine the fix in r51169 to only apply when the operand val beingDan Gohman2008-05-201-3/+4
| | | | | | | | replaced is a PHI. This prevents it from inserting uses before defs in the case that it isn't a PHI and it depends on other instructions later in the block. This fixes the 447.dealII regression on x86-64. llvm-svn: 51292
* Fix a bug in LoopStrengthReduce that caused it to emit IR withDan Gohman2008-05-151-3/+21
| | | | | | | | | | | | | | | | | use-before-def. The problem comes up in code with multiple PHIs where one PHI is being rewritten in terms of the other, but the other needs to be casted first. LLVM rules requre the cast instruction to be inserted after any PHI instructions, but when instructions were inserted to replace the second PHI value with a function of the first, they were ended up going before the cast instruction. Avoid this problem by remembering the location of the cast instruction, when one is needed, and inserting the expansion of the new value after it. This fixes a bug that surfaced in 255.vortex on x86-64 when instcombine was removed from the middle of the loop optimization passes. llvm-svn: 51169
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-2/+4
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Minor whitespace and comment cleanups.Dan Gohman2008-04-141-3/+3
| | | | llvm-svn: 49671
OpenPOWER on IntegriCloud