summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-apply r80926, with fixes: keep the domtree informed of new blocksDan Gohman2009-09-081-7/+8
| | | | | | | | | | | | | | | that get created during loop unswitching, and fix SplitBlockPredecessors' LCSSA updating code to create new PHIs instead of trying to just move existing ones. Also, optimize Loop::verifyLoop, since it gets called a lot. Use searches on a sorted list of blocks instead of calling the "contains" function, as is done in other places in the Loop class, since "contains" does a linear search. Also, don't call verifyLoop from LoopSimplify or LCSSA, as the PassManager is already calling verifyLoop as part of LoopInfo's verifyAnalysis. llvm-svn: 81221
* Revert r80926. It causes loop unswitch assertion and slow down some JIT ↵Evan Cheng2009-09-061-8/+7
| | | | | | tests significantly. llvm-svn: 81101
* Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verifyDan Gohman2009-09-031-7/+8
| | | | | | | | | that these passes are properly preserved. Fix several transformation passes that claimed to preserve LoopSimplify form but weren't. llvm-svn: 80926
* eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861Chris Lattner2009-09-021-4/+3
| | | | llvm-svn: 80766
* eliminate the "Value" printing methods that print to a std::ostream.Chris Lattner2009-08-231-29/+31
| | | | | | This required converting a bunch of stuff off DOUT and other cleanups. llvm-svn: 79819
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-7/+14
| | | | llvm-svn: 78948
* Rename MVT to EVT, in preparation for splitting SimpleValueType out into its ↵Owen Anderson2009-08-101-1/+1
| | | | | | own struct type. llvm-svn: 78610
* Check for !isa<Constant> instead of isa<Instruction>. ThisDan Gohman2009-08-041-1/+1
| | | | | | | matches what the comment says, and it avoids spurious BitCast instructions for Argument values. llvm-svn: 78121
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-3/+1
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Eliminate a few unused-variable warningsDouglas Gregor2009-07-291-2/+0
| | | | llvm-svn: 77519
* Move types back to the 2.5 API.Owen Anderson2009-07-291-1/+1
| | | | llvm-svn: 77516
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-1/+1
| | | | llvm-svn: 77494
* Move ConstantFP construction back to the 2.5-ish API.Owen Anderson2009-07-271-4/+2
| | | | llvm-svn: 77247
* Remove Value::getName{Start,End}, the last of the old Name APIs.Daniel Dunbar2009-07-261-5/+4
| | | | llvm-svn: 77152
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-5/+3
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Get rid of the Pass+Context magic.Owen Anderson2009-07-221-9/+19
| | | | llvm-svn: 76702
* Make Loop and MachineLoop be subclasses of LoopBase, rather than typedefs,Dan Gohman2009-07-131-1/+1
| | | | | | | | | | using the Curiously Recurring Template Pattern with LoopBase. This will help further refactoring, and future functionality for Loop. Also, Headers can now foward-declare Loop, instead of pulling in LoopInfo.h or doing tricks. llvm-svn: 75519
* This started as a small change, I swear. Unfortunately, lots of things call ↵Owen Anderson2009-07-091-5/+4
| | | | | | the [I|F]CmpInst constructors. Who knew!? llvm-svn: 75200
* Change all SCEV* to SCEV *.Dan Gohman2009-07-071-103/+103
| | | | llvm-svn: 74918
* Second batch of passes using LLVMContext.Owen Anderson2009-07-031-8/+9
| | | | llvm-svn: 74753
* Extend ScalarEvolution's multiple-exit support to compute exactDan Gohman2009-06-241-10/+2
| | | | | | | | | | | | | | | trip counts in more cases. Generalize ScalarEvolution's isLoopGuardedByCond code to recognize And and Or conditions, splitting the code out into an isNecessaryCond helper function so that it can evaluate Ands and Ors recursively, and make SCEVExpander be much more aggressive about hoisting instructions out of loops. test/CodeGen/X86/pr3495.ll has an additional instruction now, but it appears to be due to an arbitrary register allocation difference. llvm-svn: 74048
* Don't emit a redundant BitCastInst if the value to be defined in theDan Gohman2009-06-241-1/+2
| | | | | | preheader is already an instruction. llvm-svn: 74031
* SCEVHandle is no more!Owen Anderson2009-06-221-103/+103
| | | | llvm-svn: 73906
* Rename a variable for consistency with the ExitBlock vs ExitingBlockDan Gohman2009-06-211-6/+6
| | | | | | terminology that LoopInfo uses. llvm-svn: 73863
* Fix a typo in a comment that Frits von Bommel noticed.Dan Gohman2009-06-191-1/+1
| | | | llvm-svn: 73796
* Re-apply r73718, now that the fix in r73787 is in, and add aDan Gohman2009-06-191-30/+36
| | | | | | | hand-crafted testcase which demonstrates the bug that was exposed in 254.gap. llvm-svn: 73793
* Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,Dan Gohman2009-06-191-0/+5
| | | | | | which it isn't prepared to handle. llvm-svn: 73787
* Revert 73718. It's breaking 254.gap.Evan Cheng2009-06-191-35/+29
| | | | llvm-svn: 73783
* Generalize LSR's OptimizeSMax to handle unsigned max tests as wellDan Gohman2009-06-181-29/+35
| | | | | | | as signed max tests. Along with r73717, this helps CodeGen avoid emitting code for a maximum operation for this class of loop. llvm-svn: 73718
* Remove the code from IVUsers that attempted to handleDan Gohman2009-06-181-16/+2
| | | | | | | | | | | casted induction variables in cases where the cast isn't foldable. It ended up being a pessimization in many cases. This could be fixed, but it would require a bunch of complicated code in IVUsers' clients. The advantages of this approach aren't visible enough to justify it at this time. llvm-svn: 73706
* Update comments to use doxygen syntax.Dan Gohman2009-06-171-11/+11
| | | | llvm-svn: 73621
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-151-7/+7
| | | | | | | | | | | | | | | failures. To support this, add some utility functions to Type to help support vector/scalar-independent code. Change ConstantInt::get and ConstantFP::get to support vector types, and add an overload to ConstantInt::get that uses a static IntegerType type, for convenience. Introduce a new getConstant method for ScalarEvolution, to simplify common use cases. llvm-svn: 73431
* Convert several parts of the ScalarEvolution framework to useDan Gohman2009-06-141-8/+8
| | | | | | SmallVector instead of std::vector. llvm-svn: 73357
* Simplify.Devang Patel2009-06-051-15/+5
| | | | llvm-svn: 72965
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-1/+2
| | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt llvm-svn: 72897
* Revert 72493 and replace it with a more conservative fix, for now: don'tDan Gohman2009-05-271-7/+8
| | | | | | | | rewrite the comparison if there is any implicit extension or truncation on the induction variable. I'm planning for IVUsers to eventually take over some of the work of this code, and for it to be generalized. llvm-svn: 72496
* In ChangeCompareStride, when the stride to be reused is truncated toDan Gohman2009-05-271-2/+7
| | | | | | | a smaller type, promoted its offset back up to the type of the new comparison. This fixes PR4222. llvm-svn: 72493
* Suppress the IV reversal transformation in the case that the RHSDan Gohman2009-05-201-0/+5
| | | | | | | | of the comparison is defined inside the loop. This fixes a use-before-def problem, because the transformation puts a use of the RHS outside the loop. llvm-svn: 72149
* Add some more comments to the top of this file.Dan Gohman2009-05-191-1/+8
| | | | llvm-svn: 72131
* Trim unneeded #includes.Dan Gohman2009-05-191-1/+0
| | | | llvm-svn: 72130
* Teach SCEVExpander to expand arithmetic involving pointers into GEPDan Gohman2009-05-191-12/+13
| | | | | | | | | | | | | | | | instructions. It attempts to create high-level multi-operand GEPs, though in cases where this isn't possible it falls back to casting the pointer to i8* and emitting a GEP with that. Using GEP instructions instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that don't use ScalarEvolution, such as BasicAliasAnalysis. Also, make the AddrModeMatcher more aggressive in handling GEPs. Previously it assumed that operand 0 of a GEP would require a register in almost all cases. It now does extra checking and can do more matching if operand 0 of the GEP is foldable. This fixes a problem that was exposed by SCEVExpander using GEPs. llvm-svn: 72093
* Rename UseTy to AccessTy, for consistency with getAccessType, and toDan Gohman2009-05-181-24/+25
| | | | | | avoid ambiguity with the word "use" in IVStrideUse. llvm-svn: 72012
* Add an int64_t variant of abs, for host environmentsDale Johannesen2009-05-131-3/+3
| | | | | | | | | | | without one. Use it where we were using abs on int64_t objects. (I strongly suspect the casts to unsigned in the fragments in LoopStrengthReduce are not doing whatever the original intent was, but the obvious change to uint64_t doesn't work. Maybe later.) llvm-svn: 71612
* Factor the code for collecting IV users out of LSR into an IVUsers class,Dan Gohman2009-05-121-354/+215
| | | | | | | | | | | | | | | | | | | | | | | | and generalize it so that it can be used by IndVarSimplify. Implement the base IndVarSimplify transformation code using IVUsers. This removes TestOrigIVForWrap and associated code, as ScalarEvolution now has enough builtin overflow detection and folding logic to handle all the same cases, and more. Run "opt -iv-users -analyze -disable-output" on your favorite loop for an example of what IVUsers does. This lets IndVarSimplify eliminate IV casts and compute trip counts in more cases. Also, this happens to finally fix the remaining testcases in PR1301. Now that IndVarSimplify is being more aggressive, it occasionally runs into the problem where ScalarEvolutionExpander's code for avoiding duplicate expansions makes it difficult to ensure that all expanded instructions dominate all the instructions that will use them. As a temporary measure, IndVarSimplify now uses a FixUsesBeforeDefs function to fix up instructions inserted by SCEVExpander. Fortunately, this code is contained, and can be easily removed once a more comprehensive solution is available. llvm-svn: 71535
* Teach LSR to optimize more loop exit compares, i.e. change them to use ↵Evan Cheng2009-05-111-43/+139
| | | | | | | | postinc iv value. Previously LSR would only optimize those which are in the loop latch block. However, if LSR can prove it is safe (and profitable), it's now possible to change those not in the latch blocks to use postinc values. Also, if the compare is the only use, LSR would place the iv increment instruction before the compare instead in the latch. llvm-svn: 71485
* Reverse a loop that is counting up to a maximum toDale Johannesen2009-05-111-6/+118
| | | | | | | | count down to 0 instead, under very restricted circumstances. Adjust 4 testcases in which this optimization fires. llvm-svn: 71439
* Factor out code that optimize loop terminating condition.Evan Cheng2009-05-091-0/+9
| | | | llvm-svn: 71305
* Unbreak the build.Evan Cheng2009-05-061-1/+1
| | | | llvm-svn: 71091
* Make sure to use signed arithmetic in APInt to fix a regression.David Greene2009-05-061-2/+3
| | | | llvm-svn: 71090
* Fix a copy+pasto in a comment.Dan Gohman2009-05-051-1/+1
| | | | llvm-svn: 71035
OpenPOWER on IntegriCloud