aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix whitespace.Dan Gohman2010-08-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110223 91177308-0d34-0410-b5e6-96231b3b80d8
* Prefix `next' iterator operation with `llvm::'.Oscar Fuentes2010-08-021-3/+3
| | | | | | | | | Fixes potential ambiguity problems on VS 2010. Patch by nobled! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110029 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't merge uses when they are targetting fixup sites withDan Gohman2010-07-151-1/+20
| | | | | | | | | | | | | | different widths. In a use with a narrower fixup, formulae may be wider than the fixup, in which case the high bits aren't necessarily meaningful, so it isn't safe to reuse them for uses with wider fixups. This fixes PR7618, though the testcase is too large for a reasonable regression test, since it heavily dependes on hitting LSR's heuristics in a certain way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108455 91177308-0d34-0410-b5e6-96231b3b80d8
* Use dbgs() instead of errs() in a DEBUG.Dan Gohman2010-07-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108453 91177308-0d34-0410-b5e6-96231b3b80d8
* Watch out for a constant offset cancelling out a base register, formingDan Gohman2010-07-151-2/+9
| | | | | | | | a zero. This situation arrises in Fortran code with induction variables that start at 1 instead of 0. This fixes PR7651. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108424 91177308-0d34-0410-b5e6-96231b3b80d8
* use getArgOperand instead of getOperandGabor Greif2010-06-301-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107270 91177308-0d34-0410-b5e6-96231b3b80d8
* In GenerateReassociations, don't bother thinking about individualDan Gohman2010-06-251-8/+22
| | | | | | | | | SCEVUnknown values which are loop-variant, as LSR can't do anything interesting with these values in any case. This fixes very slow compile times on loops which have large numbers of such values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106897 91177308-0d34-0410-b5e6-96231b3b80d8
* A few minor micro-optimizations.Dan Gohman2010-06-241-5/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106764 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach getExactSDiv to evaluate x/1 to x up front, as it's a commonDan Gohman2010-06-241-8/+16
| | | | | | | | enough special case, and it theoretically allows more folding because it works even when x is unanalyzable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106763 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix copy+pasto issues in isMulSExtable.Dan Gohman2010-06-241-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106759 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix OptimizeMax to handle an odd case where one of the max operandsDan Gohman2010-06-221-1/+4
| | | | | | | is another max which folds. This fixes PR7454. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106594 91177308-0d34-0410-b5e6-96231b3b80d8
* Use A.append(...) instead of A.insert(A.end(), ...) when A is aDan Gohman2010-06-211-7/+6
| | | | | | | SmallVector, and other SmallVector simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a TODO comment.Dan Gohman2010-06-191-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106397 91177308-0d34-0410-b5e6-96231b3b80d8
* Include the use kind along with the expression in the key of theDan Gohman2010-06-191-2/+28
| | | | | | | | | | | | | use sharing map. The reconcileNewOffset logic already forces a separate use if the kinds differ, so incorporating the kind in the key means we can track more sharing opportunities. More sharing means fewer total uses to track, which means smaller problem sizes, which means the conservative throttles don't kick in as often. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106396 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't include things in anonymous namespaces that don't need it.Dan Gohman2010-06-191-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106395 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't track users of undef values; they aren't interesting forDan Gohman2010-06-041-1/+5
| | | | | | | register pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105501 91177308-0d34-0410-b5e6-96231b3b80d8
* DominatorTree.getNode can return null for unreachable blocks.Dan Gohman2010-05-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104290 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code cleanups.Dan Gohman2010-05-201-8/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104287 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Solve check its own post-condition, to reduce clutter in theDan Gohman2010-05-201-1/+2
| | | | | | | top-level LSRInstance logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104278 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comments.Dan Gohman2010-05-201-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104276 91177308-0d34-0410-b5e6-96231b3b80d8
* More code cleanups. Use iterators instead of indices when indicesDan Gohman2010-05-201-22/+24
| | | | | | | aren't needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104273 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix OptimizeShadowIV to set Changed. Change OptimizeLoopTermCond to setDan Gohman2010-05-201-8/+7
| | | | | | | | | | Changed directly instead of using a return value. Rename FilterOutUndesirableDedicatedRegisters's Changed variable to distinguish it from LSRInstance's Changed member. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104269 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some comments.Dan Gohman2010-05-201-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104268 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify this code. Don't do a DomTreeNode lookup for each visited block.Dan Gohman2010-05-201-14/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104267 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code cleanups.Dan Gohman2010-05-201-20/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104263 91177308-0d34-0410-b5e6-96231b3b80d8
* When canonicalizing icmp operand order to put the loop invariantDan Gohman2010-05-201-0/+1
| | | | | | | | | | | | | operand on the left, the interesting operand is on the right. This fixes a bug where LSR was failing to recognize ICmpZero uses, which led it to be unable to reverse the induction variable in the attached testcase. Delete test/CodeGen/X86/stack-color-with-reg-2.ll, because its test is extremely fragile and hard to meaningfully update. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104262 91177308-0d34-0410-b5e6-96231b3b80d8
* Set Changed to true when canonicalizing ICmp operand order; even thoughDan Gohman2010-05-201-0/+1
| | | | | | | it isn't a very interesting change, it's a change nonetheless. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104260 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename a variable to avoid shadowing.Dan Gohman2010-05-201-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104234 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code simplification.Dan Gohman2010-05-201-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104232 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the code for deleting BaseRegs and LSRUses into helper functions,Dan Gohman2010-05-201-5/+22
| | | | | | | | and fix a bug that valgrind noticed where the code would std::swap an element with itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104225 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach LSR how to cope better with unrolled loops on targets whereDan Gohman2010-05-191-3/+191
| | | | | | | | | the addressing modes don't make this trivially easy. This allows it to avoid falling into the less precise heuristics in more cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104186 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2010-05-181-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104089 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the predicate which checks for non-sensical formulae which haveDan Gohman2010-05-181-4/+5
| | | | | | | constants in registers which partially cancel out their immediate fields. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104088 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out the code for recomputing an LSRUse's Regs set after someDan Gohman2010-05-181-17/+40
| | | | | | | | of its formulae have been removed into a helper function, and also teach it how to update the RegUseTracker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104087 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out code for estimating search space complexity into a helperDan Gohman2010-05-181-22/+26
| | | | | | | function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104082 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some more debug output.Dan Gohman2010-05-181-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104080 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out the code for deleting a formula from an LSRUse intoDan Gohman2010-05-181-4/+9
| | | | | | | a helper function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104079 91177308-0d34-0410-b5e6-96231b3b80d8
* Make some debug output more informative.Dan Gohman2010-05-181-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104078 91177308-0d34-0410-b5e6-96231b3b80d8
* Print an error message in Formula::print if the HasBaseReg flagDan Gohman2010-05-181-0/+7
| | | | | | | | is inconsistent with the BaseRegs field. It's not print's job to assert on an invalid condition, but it can make one more obvious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104077 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename RegUseTracker's RegUses member to RegUsesMap to avoidDan Gohman2010-05-181-7/+7
| | | | | | | confusion with LSRInstance's RegUses member. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104076 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!Douglas Gregor2010-05-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103457 91177308-0d34-0410-b5e6-96231b3b80d8
* When pruning candidate formulae out of an LSRUse, update theDan Gohman2010-05-071-3/+11
| | | | | | | | | | | | | | LSRUse's Regs set after all pruning is done, rather than trying to do it on the fly, which can produce an incomplete result. This fixes a case where heuristic pruning was stripping all formulae from a use, which led the solver to enter an infinite loop. Also, add a few asserts to diagnose this kind of situation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103328 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getConstant instead of getIntegerSCEV. The two are basically theDan Gohman2010-05-031-12/+11
| | | | | | | same, now that getConstant has overloads consistent with ConstantInt::get. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102965 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize LSR's OptimizeMax to handle the new kinds of max expressionsDan Gohman2010-04-241-10/+43
| | | | | | | that indvars may use, now that indvars is recognizing le and ge loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102235 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix LSR to tolerate cases where ScalarEvolution initiallyDan Gohman2010-04-231-1/+4
| | | | | | | | misses an opportunity to fold add operands, but folds them after LSR has separated them out. This fixes rdar://7886751. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102157 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the Expr member from IVUsers. Instead of remembering the expression,Dan Gohman2010-04-191-6/+5
| | | | | | | | just ask ScalarEvolution for it on demand. This helps IVUsers be more robust in the case of expressions changing underneath it. This fixes PR6862. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101819 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete this code, which is no longer needed.Dan Gohman2010-04-121-4/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101033 91177308-0d34-0410-b5e6-96231b3b80d8
* When determining a canonical insert position, don't climb deeperDan Gohman2010-04-091-33/+73
| | | | | | | | | into adjacent loops. Also, ensure that the insert position is dominated by the loop latch of any loop in the post-inc set which has a latch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100906 91177308-0d34-0410-b5e6-96231b3b80d8
* When looking for loop-invariant users, look through no-op instructions,Dan Gohman2010-04-091-3/+11
| | | | | | | | so that an unfortunately placed bitcast doesn't pin a value in a register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100883 91177308-0d34-0410-b5e6-96231b3b80d8