summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* * Pull some code out into the definedInRegion/definedInCaller methodsChris Lattner2004-05-121-78/+78
| | | | | | | | | | | | | | | | * Add a stub for the severSplitPHINodes which will allow us to bbextract bb's with PHI nodes in them soon. * Remove unused arguments from findInputsOutputs * Dramatically simplify the code in findInputsOutputs. In particular, nothing really cares whether or not a PHI node is using something. * Move moveCodeToFunction to after emitCallAndSwitchStatement as that's the order they get called. * Fix a bug where we would code extract a region that included a call to vastart. Like 'alloca', calls to vastart must stay in the function that they are defined in. * Add some comments. llvm-svn: 13482
* Generate substantially better code when there are a limited number of exitsChris Lattner2004-05-121-22/+61
| | | | | | | | | | | from the extracted region. If the return has 0 or 1 exit blocks, the new function returns void. If it has 2 exits, it returns bool, otherwise it returns a ushort as before. This allows us to use a conditional branch instruction when there are two exit blocks, as often happens during block extraction. llvm-svn: 13481
* Two minor improvements:Chris Lattner2004-05-121-18/+14
| | | | | | | | | | | | 1. Get rid of the silly abort block. When doing bb extraction, we get one abort block for every block extracted, which is kinda annoying. 2. If the switch ends up having a single destination, turn it into an unconditional branch. I would like to add support for conditional branches, but to do this we will want to have the function return a bool instead of a ushort. llvm-svn: 13478
* Fix stupid bug in my checkin yesterdayChris Lattner2004-05-081-2/+1
| | | | llvm-svn: 13429
* Implement folding of GEP's like:Chris Lattner2004-05-071-53/+43
| | | | | | | | | %tmp.0 = getelementptr [50 x sbyte]* %ar, uint 0, int 5 ; <sbyte*> [#uses=2] %tmp.7 = getelementptr sbyte* %tmp.0, int 8 ; <sbyte*> [#uses=1] together. This patch actually allows us to simplify and generalize the code. llvm-svn: 13415
* Fix PR336: The instcombine pass asserts when visiting load instructionChris Lattner2004-05-071-2/+3
| | | | llvm-svn: 13400
* Do not mark instructions in unreachable sections of the function as live.Chris Lattner2004-05-041-2/+5
| | | | | | This fixes PR332 and ADCE/2004-05-04-UnreachableBlock.llx llvm-svn: 13349
* Minor efficiency tweak, suggested by Patrick MeredithChris Lattner2004-05-041-4/+4
| | | | llvm-svn: 13341
* Fix typoBrian Gaeke2004-05-031-1/+1
| | | | llvm-svn: 13340
* In InsertProfilingInitCall(), make it legal to pass in a null array, inBrian Gaeke2004-05-032-7/+13
| | | | | | which case you'll get a null array and zero passed to the profiling function. llvm-svn: 13336
* Add initial implementation of basic-block tracing instrumentation pass.Brian Gaeke2004-05-031-0/+76
| | | | llvm-svn: 13335
* Do not clone arbitrary condition instructions.Chris Lattner2004-05-021-1/+1
| | | | llvm-svn: 13316
* Do not infinitely "unroll" single BB loops.Chris Lattner2004-05-021-5/+4
| | | | llvm-svn: 13315
* Dont' merge terminators that are needed to select PHI node values.Chris Lattner2004-05-021-1/+1
| | | | llvm-svn: 13312
* Implement SimplifyCFG/branch-cond-merge.llChris Lattner2004-05-011-10/+64
| | | | | | Turning "if (A < B && B < C)" into "if (A < B & B < C)" llvm-svn: 13311
* Make sure to reprocess instructions used by deleted instructions to avoidChris Lattner2004-05-011-5/+12
| | | | | | missing opportunities for combination. llvm-svn: 13309
* Make sure the instruction combiner doesn't lose track of instructionsChris Lattner2004-05-011-3/+6
| | | | | | when replacing them, missing the opportunity to do simplifications llvm-svn: 13308
* Fix my missing parensChris Lattner2004-05-011-1/+1
| | | | llvm-svn: 13307
* Implement SimplifyCFG/branch-cond-prop.llChris Lattner2004-05-011-2/+30
| | | | llvm-svn: 13306
* Fix a major pessimization in the instcombiner. If an allocation instructionChris Lattner2004-04-301-1/+1
| | | | | | | | | | | | | | | is only used by a cast, and the casted type is the same size as the original allocation, it would eliminate the cast by folding it into the allocation. Unfortunately, it was placing the new allocation instruction right before the cast, which could pull (for example) alloca instructions into the body of a function. This turns statically allocatable allocas into expensive dynamically allocated allocas, which is bad bad bad. This fixes the problem by placing the new allocation instruction at the same place the old one was, duh. :) llvm-svn: 13289
* Changes to fix up the inst_iterator to pass to boost iterator checks. ThisChris Lattner2004-04-273-3/+12
| | | | | | patch was graciously contributed by Vladimir Prus. llvm-svn: 13185
* Instcombine X/-1 --> 0-XChris Lattner2004-04-261-1/+5
| | | | llvm-svn: 13172
* * Allow aggregating extracted function arguments (controlled by flag)Misha Brukman2004-04-231-45/+197
| | | | | | * Commandline option (for now) controls that flag that is passed in llvm-svn: 13141
* Move the scev expansion code into this pass, where it belongs. There isChris Lattner2004-04-231-12/+252
| | | | | | | still room for cleanup, but at least the code modification is out of the analysis now. llvm-svn: 13135
* Clarify the logic: the flag is renamed to `deleteFn' to signify it will deleteMisha Brukman2004-04-221-11/+11
| | | | | | the function instead of isolating it. This also means the condition is reversed. llvm-svn: 13112
* Add a flag to choose between isolating a function or deleting the function fromMisha Brukman2004-04-221-6/+29
| | | | | | | the Module. The default behavior keeps functionality as before: the chosen function is the one that remains. llvm-svn: 13111
* Disable a previous patch that was causing indvars to loop infinitely :(Chris Lattner2004-04-221-0/+2
| | | | llvm-svn: 13108
* Fix an extremely serious thinko I made in revision 1.60 of this file.Chris Lattner2004-04-221-16/+25
| | | | llvm-svn: 13106
* 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
* This code really wants to iterate over the OPERANDS of an instruction, notChris Lattner2004-04-211-3/+2
| | | | | | | | over its USES. If it's dead it doesn't have any uses! :) Thanks to the fabulous and mysterious Bill Wendling for pointing this out. :) llvm-svn: 13102
* 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
* Fix an incredibly nasty iterator invalidation problem. I am too spoiled by ↵Chris Lattner2004-04-211-18/+38
| | | | | | | | | ilists :) Eventually it would be nice if CallGraph maintained an ilist of CallGraphNode's instead of a vector of pointers to them, but today is not that day. llvm-svn: 13100
* Include cerrno (gcc-3.4 fix)Alkis Evlogimenos2004-04-211-0/+1
| | | | llvm-svn: 13091
* Fix typeoChris Lattner2004-04-211-1/+1
| | | | llvm-svn: 13089
* REALLY fix PR324: don't delete linkonce functions until after the SCC traversalChris Lattner2004-04-202-7/+33
| | | | | | is done, which avoids invalidating iterators in the SCC traversal routines llvm-svn: 13088
* Fix PR325Chris Lattner2004-04-201-1/+1
| | | | llvm-svn: 13081
* Fix PR324 and testcase: Inline/2004-04-20-InlineLinkOnce.llxChris Lattner2004-04-201-3/+7
| | | | llvm-svn: 13080
* Initial checkin of a simple loop unswitching pass. It still needs work,Chris Lattner2004-04-191-0/+357
| | | | | | but it's a start, and seems to do it's basic job. llvm-svn: 13068
* Add #includeChris Lattner2004-04-191-0/+1
| | | | llvm-svn: 13057
* Move isLoopInvariant to the Loop classChris Lattner2004-04-181-10/+2
| | | | llvm-svn: 13051
* Correct rewriting of exit blocks after my last patchChris Lattner2004-04-181-3/+8
| | | | llvm-svn: 13048
* Loop exit sets are no longer explicitly held, they are dynamically computed ↵Chris Lattner2004-04-181-3/+6
| | | | | | on demand. llvm-svn: 13046
* Change the ExitBlocks list from being explicitly contained in the LoopChris Lattner2004-04-184-107/+17
| | | | | | | structure to being dynamically computed on demand. This makes updating loop information MUCH easier. llvm-svn: 13045
* Reduce the unrolling limitChris Lattner2004-04-181-1/+1
| | | | llvm-svn: 13040
* If the preheader of the loop was the entry block of the function, make sureChris Lattner2004-04-181-2/+7
| | | | | | | | that the exit block of the loop becomes the new entry block of the function. This was causing a verifier assertion on 252.eon. llvm-svn: 13039
* Be much more careful about how we update instructions outside of the loopChris Lattner2004-04-181-9/+15
| | | | | | | using instructions inside of the loop. This should fix the MishaTest failure from last night. llvm-svn: 13038
* After unrolling our single basic block loop, fold it into the preheader and exitChris Lattner2004-04-181-2/+43
| | | | | | | | | | | | | block. The primary motivation for doing this is that we can now unroll nested loops. This makes a pretty big difference in some cases. For example, in 183.equake, we are now beating the native compiler with the CBE, and we are a lot closer with LLC. I'm now going to play around a bit with the unroll factor and see what effect it really has. llvm-svn: 13034
* Fix a bug: this does not preserve the CFG!Chris Lattner2004-04-181-4/+20
| | | | | | While we're at it, add support for updating loop information correctly. llvm-svn: 13033
* Initial checkin of a simple loop unroller. This pass is extremely basic andChris Lattner2004-04-181-0/+247
| | | | | | | | limited. Even in it's extremely simple state (it can only *fully* unroll single basic block loops that execute a constant number of times), it already helps improve performance a LOT on some benchmarks, particularly with the native code generators. llvm-svn: 13028
* Make the tail duplication threshold accessible from the command line instead ↵Chris Lattner2004-04-181-1/+5
| | | | | | of hardcoded llvm-svn: 13025
OpenPOWER on IntegriCloud