summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement a todo, rewriting all possible scev expressions inside of theChris Lattner2004-04-211-8/+18
| | | | | | | | loop. This eliminates the extra add from the previous case, but it's not clear that this will be a performance win overall. Tommorows test results will tell. :) llvm-svn: 13103
* Implement a fixme. The helps loops that have induction variables of differentChris Lattner2004-04-211-17/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | types in them. Instead of creating an induction variable for all types, it creates a single induction variable and casts to the other sizes. This generates this code: no_exit: ; preds = %entry, %no_exit %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=4] *** %j.0.0 = cast uint %indvar to short ; <short> [#uses=1] %indvar = cast uint %indvar to int ; <int> [#uses=1] %tmp.7 = getelementptr short* %P, uint %indvar ; <short*> [#uses=1] store short %j.0.0, short* %tmp.7 %inc.0 = add int %indvar, 1 ; <int> [#uses=2] %tmp.2 = setlt int %inc.0, %N ; <bool> [#uses=1] %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] br bool %tmp.2, label %no_exit, label %loopexit instead of: no_exit: ; preds = %entry, %no_exit %indvar = phi ushort [ %indvar.next, %no_exit ], [ 0, %entry ] ; <ushort> [#uses=2] *** %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=3] %indvar = cast uint %indvar to int ; <int> [#uses=1] %indvar = cast ushort %indvar to short ; <short> [#uses=1] %tmp.7 = getelementptr short* %P, uint %indvar ; <short*> [#uses=1] store short %indvar, short* %tmp.7 %inc.0 = add int %indvar, 1 ; <int> [#uses=2] %tmp.2 = setlt int %inc.0, %N ; <bool> [#uses=1] %indvar.next = add uint %indvar, 1 *** %indvar.next = add ushort %indvar, 1 br bool %tmp.2, label %no_exit, label %loopexit This is an improvement in register pressure, but probably doesn't happen that often. The more important fix will be to get rid of the redundant add. llvm-svn: 13101
* Change the ExitBlocks list from being explicitly contained in the LoopChris Lattner2004-04-181-4/+8
| | | | | | | structure to being dynamically computed on demand. This makes updating loop information MUCH easier. llvm-svn: 13045
* If the loop executes a constant number of times, try a bit harder to replaceChris Lattner2004-04-171-2/+5
| | | | | | exit values. llvm-svn: 13018
* Even if there are not any induction variables in the loop, if we can computeChris Lattner2004-04-171-1/+11
| | | | | | | the trip count for the loop, insert one so that we can canonicalize the exit condition. llvm-svn: 13015
* Fix some of the strange CBE-only failures that happened last night.Chris Lattner2004-04-161-0/+1
| | | | llvm-svn: 12980
* Fix a bug in the previous checkin: if the exit block is not the same asChris Lattner2004-04-151-7/+23
| | | | | | the back-edge block, we must check the preincremented value. llvm-svn: 12968
* Change the canonical induction variable that we insert.Chris Lattner2004-04-151-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of producing code like this: Loop: X = phi 0, X2 ... X2 = X + 1 if (X != N-1) goto Loop We now generate code that looks like this: Loop: X = phi 0, X2 ... X2 = X + 1 if (X2 != N) goto Loop This has two big advantages: 1. The trip count of the loop is now explicit in the code, allowing the direct implementation of Loop::getTripCount() 2. This reduces register pressure in the loop, and allows X and X2 to be put into the same register. As a consequence of the second point, the code we generate for loops went from: .LBB2: # no_exit.1 ... mov %EDI, %ESI inc %EDI cmp %ESI, 2 mov %ESI, %EDI jne .LBB2 # PC rel: no_exit.1 To: .LBB2: # no_exit.1 ... inc %ESI cmp %ESI, 3 jne .LBB2 # PC rel: no_exit.1 ... which has two fewer moves, and uses one less register. llvm-svn: 12961
* Rewrite the indvars pass to use the ScalarEvolution analysis.Chris Lattner2004-04-021-298/+346
| | | | | | | | This also implements some new features for the indvars pass, including linear function test replacement, exit value substitution, and it works with a much more general class of induction variables and loops. llvm-svn: 12620
* Improve encapsulation in the Loop and LoopInfo classes by eliminating theChris Lattner2004-01-081-4/+4
| | | | | | | getSubLoops/getTopLevelLoops methods, replacing them with iterator-based accessors. llvm-svn: 10714
* More minor non-functional changes. This now computes the exit condition, thoughChris Lattner2003-12-231-15/+52
| | | | | | it doesn't do anything with it. llvm-svn: 10590
* Don't mind me, I'm just refactoring away. This patch makes room for LFTR, butChris Lattner2003-12-221-90/+130
| | | | | | contains no functionality changes. llvm-svn: 10583
* Implement IndVarsSimplify/pointer-indvars.ll, transforming pointerChris Lattner2003-12-221-9/+19
| | | | | | arithmetic into "array subscripts" llvm-svn: 10580
* Fix PR194Chris Lattner2003-12-221-56/+85
| | | | llvm-svn: 10573
* Reverted back to previous revision - this was previously mergedJohn Criswell2003-12-181-8/+15
| | | | | | according to the CVS log messages. llvm-svn: 10517
* Merged in RELEASE_11.John Criswell2003-12-181-15/+8
| | | | llvm-svn: 10516
* Fix for PR185 & IndVarsSimplify/2003-12-15-Crash.llxChris Lattner2003-12-151-0/+9
| | | | llvm-svn: 10473
* Fix bug: IndVarsSimplify/2003-12-10-RemoveInstrCrash.llxChris Lattner2003-12-101-0/+5
| | | | llvm-svn: 10385
* Finegrainify namespacificationChris Lattner2003-12-101-8/+27
| | | | | | | Reorder #includes Implement: IndVarsSimplify/2003-12-10-IndVarDeadCode.ll llvm-svn: 10376
* Put all LLVM code into the llvm namespace, as per bug 109.Brian Gaeke2003-11-111-0/+4
| | | | llvm-svn: 9903
* Added LLVM project notice to the top of every C++ source file.John Criswell2003-10-201-0/+7
| | | | | | Header files will be on the way. llvm-svn: 9298
* Rename loop preheaders pass to loop simplifyChris Lattner2003-10-121-1/+1
| | | | llvm-svn: 9061
* Fix spelling.Misha Brukman2003-10-101-1/+1
| | | | llvm-svn: 9027
* Fix bug: IndVarsSimplify/2003-09-23-NotAtTop.llChris Lattner2003-09-231-2/+8
| | | | llvm-svn: 8689
* Make sure to cannonicalize loops before running indvar simplifyChris Lattner2003-09-121-0/+1
| | | | llvm-svn: 8502
* Spelling fixes. I think that "cannonical" is ok, but "canonical" appears toChris Lattner2003-09-101-21/+21
| | | | | | be the canonical form for the word llvm-svn: 8430
* Fix up file headerChris Lattner2003-09-101-2/+4
| | | | llvm-svn: 8428
* DEBUG got moved to Support/Debug.hChris Lattner2003-08-011-1/+2
| | | | llvm-svn: 7492
* Remove unnecesary &*'sChris Lattner2003-04-231-1/+1
| | | | llvm-svn: 5872
* - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG toChris Lattner2002-10-211-1/+1
| | | | | | setPreservesCFG to be less confusing. llvm-svn: 4255
* Updates to work with recent Statistic's changes:Chris Lattner2002-10-011-3/+3
| | | | | | | | | | | | * Renamed StatisticReporter.h/cpp to Statistic.h/cpp * Broke constructor to take two const char * arguments instead of one, so that indendation can be taken care of automatically. * Sort the list by pass name when printing * Make sure to print all statistics as a group, instead of randomly when the statistics dtors are called. * Updated ProgrammersManual with new semantics. llvm-svn: 4002
* Simplify code (somtimes dramatically), by using the new "auto-insert" featureChris Lattner2002-09-101-21/+9
| | | | | | of instruction constructors. llvm-svn: 3656
* * Clean up code a little bitChris Lattner2002-09-101-19/+27
| | | | | | * Fix bug: test/Regression/Transforms/IndVarsSimplify/2002-09-09-PointerIndVar.ll llvm-svn: 3644
* - Cleaned up the interface to AnalysisUsage to take analysis class namesChris Lattner2002-08-081-1/+1
| | | | | | | instead of ::ID's. - Pass::getAnalysis<> now no longer takes an optional argument llvm-svn: 3265
* * Standardize how analysis results/passes as printed with the print() virtualChris Lattner2002-07-271-2/+1
| | | | | | | | | | methods * Eliminate AnalysisID: Now it is just a typedef for const PassInfo* * Simplify how AnalysisID's are initialized * Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into the analyses themselves. llvm-svn: 3116
* * Add support for different "PassType's"Chris Lattner2002-07-261-1/+1
| | | | | | | | | | | | | | | * Add new RegisterOpt/RegisterAnalysis templates for registering passes that are to show up in opt or analyze * Register Analyses now * Change optimizations to use RegisterOpt instead of RegisterPass * Add support for different "PassType's" * Add new RegisterOpt/RegisterAnalysis templates for registering passes that are to show up in opt or analyze * Register Analyses now * Change optimizations to use RegisterOpt instead of RegisterPass * Remove getPassName implementations from various subclasses llvm-svn: 3113
* *** empty log message ***Chris Lattner2002-07-231-5/+2
| | | | llvm-svn: 3016
* *** empty log message ***Chris Lattner2002-06-301-1/+0
| | | | llvm-svn: 2813
* changes to make it compatible with 64bit gccAnand Shukla2002-06-251-2/+3
| | | | llvm-svn: 2792
* MEGAPATCH checkin.Chris Lattner2002-06-251-17/+12
| | | | | | For details, See: docs/2002-06-25-MegaPatchInfo.txt llvm-svn: 2779
* Use the new DEBUG(x) macro to allow debugging code to be enabled on the ↵Chris Lattner2002-05-221-10/+5
| | | | | | commandline llvm-svn: 2713
* Add support for printing out statistics information when -stats is added toChris Lattner2002-05-101-10/+14
| | | | | | the command line llvm-svn: 2601
* Merge all individual .h files into a single Scalar.h fileChris Lattner2002-05-071-1/+1
| | | | llvm-svn: 2537
* Eliminate duplicate or unneccesary #include'sChris Lattner2002-04-291-2/+0
| | | | llvm-svn: 2397
* Add new optional getPassName() virtual function that a Pass can overrideChris Lattner2002-04-291-0/+4
| | | | | | to make debugging output a lot nicer. llvm-svn: 2395
* Tighten up the AnalysisUsage of lots of passes, primarily to correctly ↵Chris Lattner2002-04-281-0/+1
| | | | | | indicate whether or not they invalidate the CFGA llvm-svn: 2386
* Split ConstantVals.h into Constant.h and Constants.hChris Lattner2002-04-281-1/+1
| | | | llvm-svn: 2378
* Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classesChris Lattner2002-04-281-4/+4
| | | | | | to the global namespace llvm-svn: 2370
* * Rename MethodPass class to FunctionPassChris Lattner2002-04-271-7/+5
| | | | | | | | | | | | | | | - Rename runOnMethod to runOnFunction * Transform getAnalysisUsageInfo into getAnalysisUsage - Method is now const - It now takes one AnalysisUsage object to fill in instead of 3 vectors to fill in - Pass's now specify which other passes they _preserve_ not which ones they modify (be conservative!) - A pass can specify that it preserves all analyses (because it never modifies the underlying program) * s/Method/Function/g in other random places as well llvm-svn: 2333
* Change Constant::getNullConstant to Constant::getNullValueChris Lattner2002-04-271-1/+1
| | | | llvm-svn: 2323
OpenPOWER on IntegriCloud