aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56230 91177308-0d34-0410-b5e6-96231b3b80d8
* fix overflow check.Devang Patel2008-09-091-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56011 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused counter.Devang Patel2008-09-081-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55924 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove OptimizeIVType()Devang Patel2008-09-081-206/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55913 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
* Add additional check to ensure that iv is canonicalized.Devang Patel2008-09-031-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55682 91177308-0d34-0410-b5e6-96231b3b80d8
* Check iteration count.Devang Patel2008-09-031-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55680 91177308-0d34-0410-b5e6-96231b3b80d8
* While removing PHI, use basicblock to identify incoming value.Devang Patel2008-09-031-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55678 91177308-0d34-0410-b5e6-96231b3b80d8
* If all IV uses are extending integer IV then change the type of IV itself, ↵Devang Patel2008-09-021-0/+201
| | | | | | if possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55674 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not apply the transformation if the target does not support DestTy natively.Devang Patel2008-08-271-2/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55433 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typos and whitespaces. Other cosmetic changes based on feedback.Devang Patel2008-08-271-12/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55424 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55374 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 54821. It's miscompiling 252.eon and 447.dealIIEvan Cheng2008-08-171-118/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54878 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 54786. Add overflow and number of mantissa bits checks.Devang Patel2008-08-151-1/+118
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54821 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 54786. It's not checking for overflows, etc.Evan Cheng2008-08-151-101/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54813 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54786 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename. s/FindIVForUser/FindIVUserForCond/gDevang Patel2008-08-131-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54754 91177308-0d34-0410-b5e6-96231b3b80d8
* Check sign to detect overflow before changing compare stride.Devang Patel2008-08-131-1/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54710 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54415 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53879 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix uninitialized use of the Changed variable.Dan Gohman2008-07-141-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53564 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53193 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix spelling and grammar in a comment.Dan Gohman2008-06-231-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52648 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve LSR's dead-phi detection to handle use-def cyclesDan Gohman2008-06-221-20/+17
| | | | | | | with more than two nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52617 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52463 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52371 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch over to SetVector to ensure same order of iterations do not vary ↵Evan Cheng2008-06-161-8/+9
| | | | | | across runs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52361 91177308-0d34-0410-b5e6-96231b3b80d8
* Iterating over SmallPtrSet is not deterministic.Evan Cheng2008-06-161-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52339 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52258 91177308-0d34-0410-b5e6-96231b3b80d8
* op_iterator-ify some loops, fix 80col violationsGabor Greif2008-06-111-9/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52226 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51521 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51359 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51292 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51169 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor whitespace and comment cleanups.Dan Gohman2008-04-141-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49671 91177308-0d34-0410-b5e6-96231b3b80d8
* API changes for class Use size reduction, wave 1.Gabor Greif2008-04-061-1/+1
| | | | | | | | | Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead options.Evan Cheng2008-03-191-13/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48556 91177308-0d34-0410-b5e6-96231b3b80d8
* Use empty() instead of comparing size() with zero.Dan Gohman2008-01-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up previous patch: PHI uses should not prevent iv reuse if all other ↵Evan Cheng2007-12-201-35/+16
| | | | | | uses are addresses. This trades a constant multiply for one fewer iv. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45251 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow iv reuse if the user is a PHI node which is in turn used as addresses.Evan Cheng2007-12-191-29/+82
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45230 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove indeterminism from a loop. We think this willDale Johannesen2007-11-171-2/+6
| | | | | | | | | fix an occasional nonrepeatable bootstrap failure we've been seeing on Darwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44202 91177308-0d34-0410-b5e6-96231b3b80d8
* At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) ↵Evan Cheng2007-10-301-9/+33
| | | | | | PHI node with the constant value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43533 91177308-0d34-0410-b5e6-96231b3b80d8
* It's not safe to tell SplitCriticalEdge to merge identical edges. It may ↵Evan Cheng2007-10-301-11/+9
| | | | | | delete the phi instruction that's being processed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43524 91177308-0d34-0410-b5e6-96231b3b80d8
* - Bug fixes.Evan Cheng2007-10-291-10/+38
| | | | | | | - Allow icmp rewrite using an iv / stride of a smaller integer type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43480 91177308-0d34-0410-b5e6-96231b3b80d8
* Update a comment to reflect the current code.Dan Gohman2007-10-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43463 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused function argument.Dan Gohman2007-10-291-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43462 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2007-10-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43461 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid calling ValidStride when not all uses are addresses.Dan Gohman2007-10-291-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43460 91177308-0d34-0410-b5e6-96231b3b80d8