summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Fix a bug in my checkin from last night that caused miscompilations ofChris Lattner2004-06-101-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 186.crafty, fhourstones and 132.ijpeg. Bugpoint makes really nasty miscompilations embarassingly easy to find. It narrowed it down to the instcombiner and this testcase (from fhourstones): bool %l7153_l4706_htstat_loopentry_2E_4_no_exit_2E_4(int* %i, [32 x int]* %works, int* %tmp.98.out) { newFuncRoot: %tmp.96 = load int* %i ; <int> [#uses=1] %tmp.97 = getelementptr [32 x int]* %works, long 0, int %tmp.96 ; <int*> [#uses=1] %tmp.98 = load int* %tmp.97 ; <int> [#uses=2] %tmp.99 = load int* %i ; <int> [#uses=1] %tmp.100 = and int %tmp.99, 7 ; <int> [#uses=1] %tmp.101 = seteq int %tmp.100, 7 ; <bool> [#uses=2] %tmp.102 = cast bool %tmp.101 to int ; <int> [#uses=0] br bool %tmp.101, label %codeRepl4.exitStub, label %codeRepl3.exitStub codeRepl4.exitStub: ; preds = %newFuncRoot store int %tmp.98, int* %tmp.98.out ret bool true codeRepl3.exitStub: ; preds = %newFuncRoot store int %tmp.98, int* %tmp.98.out ret bool false } ... which only has one combination performed on it: $ llvm-as < t.ll | opt -instcombine -debug | llvm-dis IC: Old = %tmp.101 = seteq int %tmp.100, 7 ; <bool> [#uses=1] New = setne int %tmp.100, 0 ; <bool>:<badref> [#uses=0] IC: MOD = br bool %tmp.101, label %codeRepl3.exitStub, label %codeRepl4.exitStub IC: MOD = %tmp.97 = getelementptr [32 x int]* %works, uint 0, int %tmp.96 ; <int*> [#uses=1] It doesn't get much better than this. :) llvm-svn: 14109
* More minor cleanupsChris Lattner2004-06-101-11/+8
| | | | llvm-svn: 14108
* Eliminate many occurrances of Instruction::Chris Lattner2004-06-101-134/+112
| | | | llvm-svn: 14107
* Implement InstCombine/select.ll:test15*Chris Lattner2004-06-091-40/+90
| | | | llvm-svn: 14095
* Be more careful about the order we put stuff onto the worklist. This allow ↵Chris Lattner2004-06-091-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | us to collapse this: bool %le(int %A, int %B) { %c1 = setgt int %A, %B %tmp = select bool %c1, int 1, int 0 %c2 = setlt int %A, %B %result = select bool %c2, int -1, int %tmp %c3 = setle int %result, 0 ret bool %c3 } into: bool %le(int %A, int %B) { %c3 = setle int %A, %B ; <bool> [#uses=1] ret bool %c3 } which is handy, because the Java FE makes these sequences all over the place. This is tested as: test/Regression/Transforms/InstCombine/JavaCompare.ll llvm-svn: 14086
* Implement select.ll:test14*Chris Lattner2004-06-091-35/+59
| | | | llvm-svn: 14083
* Expand head-of-file comment.Brian Gaeke2004-06-031-1/+3
| | | | llvm-svn: 13982
* Use new form of unconditional branch constructor.Brian Gaeke2004-06-011-1/+1
| | | | llvm-svn: 13930
* Fix one of the major things that is causing the C Backend to infinite loopChris Lattner2004-05-281-0/+1
| | | | llvm-svn: 13872
* Fix a bug in the -deadtypeelim pass. The SymbolTable re-write changed itJohn Criswell2004-05-271-1/+1
| | | | | | to eliminate the wrong type. llvm-svn: 13855
* Fix InstCombine/load.ll & PR347.Chris Lattner2004-05-271-12/+24
| | | | | | | | | | This code hadn't been updated after the "structs with more than 256 elements" related changes to the GEP instruction. Also it was not handling the ConstantAggregateZero class. Now it does! llvm-svn: 13834
* Implement constant folding of fmod, which is used a lot in povrayChris Lattner2004-05-271-2/+9
| | | | llvm-svn: 13823
* Restructure call constant folding code a bit to make it simplerChris Lattner2004-05-271-39/+40
| | | | | | | | Add support for acos/asin/atan. 188.ammp contains three calls to acos with constant arguments. Constant folding it allows elimination of those 3 calls and three FP divisions of the results. llvm-svn: 13821
* Do not pass a null pointer if this instruction is not prepended orAlkis Evlogimenos2004-05-261-2/+2
| | | | | | appended anywhere. llvm-svn: 13798
* Use one destination constructor for the unconditional branch.Alkis Evlogimenos2004-05-261-1/+1
| | | | llvm-svn: 13792
* Convert to SymbolTable's new iteration interface.Reid Spencer2004-05-253-32/+31
| | | | llvm-svn: 13754
* Convert to SymbolTable's new lookup and iteration interfaces.Reid Spencer2004-05-251-23/+23
| | | | llvm-svn: 13751
* Remove unused header file.Reid Spencer2004-05-251-1/+0
| | | | llvm-svn: 13750
* Make this pass simply invoke SymbolTable::strip().Reid Spencer2004-05-251-31/+2
| | | | llvm-svn: 13749
* Implement InstCombine:shift.ll:test16, which turns (X >> C1) & C2 != C3Chris Lattner2004-05-251-0/+35
| | | | | | | | | | into (X & (C2 << C1)) != (C3 << C1), where the shift may be either left or right and the compare may be any one. This triggers 1546 times in 176.gcc alone, as it is a common pattern that occurs for bitfield accesses. llvm-svn: 13740
* Implement instcombine/cast.ll:test16:Chris Lattner2004-05-251-0/+5
| | | | | | Canonicalize cast X to bool into a setne instruction llvm-svn: 13736
* Fix a bug in my previous checkinChris Lattner2004-05-241-0/+1
| | | | llvm-svn: 13717
* Spelling people's names right is kinda importantChris Lattner2004-05-231-1/+1
| | | | llvm-svn: 13702
* Fix cases where we missed inlining some more obvious candidates because theChris Lattner2004-05-231-79/+108
| | | | | | caller was in an SCC. llvm-svn: 13693
* Simplify the interface and remove an unneeded #includeChris Lattner2004-05-231-9/+1
| | | | llvm-svn: 13692
* Fairly substantial changes to update the alias analysis we are querying asChris Lattner2004-05-231-39/+92
| | | | | | | we make the transformation. This allows us to use interprocedural alias analyses successfully. llvm-svn: 13691
* Adjust to the changes in the AliasSetTracker interfaceChris Lattner2004-05-231-16/+14
| | | | llvm-svn: 13690
* Add support for replacement of formal arguments with simpler expressions.Chris Lattner2004-05-231-2/+23
| | | | llvm-svn: 13689
* Implement the -lowergc pass which is used by code generators (like the CBE)Chris Lattner2004-05-231-0/+326
| | | | | | that do not have builtin support for garbage collection. llvm-svn: 13688
* Add CloneTraceInto(), which is based on (and has mostly the sameBrian Gaeke2004-05-191-0/+33
| | | | | | effects as) CloneFunctionInto(). llvm-svn: 13601
* Move RemapInstruction() to ValueMapper, so that it can be shared withBrian Gaeke2004-05-193-22/+26
| | | | | | | | CloneTrace, and because it is primarily an operation on ValueMaps. It is now a global (non-static) function which can be pulled in using ValueMapper.h. llvm-svn: 13600
* Clean up this pass somewhat:Brian Gaeke2004-05-141-42/+38
| | | | | | | | | | | | Add better comments, including a better head-of-file comment. Prune #includes. Fix a FIXME that Chris put here by using doInitialization(). Use DEBUG() to print out debug msgs. Give names to basic blocks inserted by this pass. Expand tabs. Use InsertProfilingInitCall() from ProfilingUtils to insert the initialize call. llvm-svn: 13581
* This was not meant to be committedChris Lattner2004-05-131-7/+0
| | | | llvm-svn: 13565
* Fix a nasty bug that caused us to unroll EXTREMELY large loops due to overflowChris Lattner2004-05-132-3/+10
| | | | | | | | | | | | | | | | | | | | in the size calculation. This is not something you want to see: Loop Unroll: F[main] Loop %no_exit Loop Size = 2 Trip Count = 2147483648 - UNROLLING! The problem was that 2*2147483648 == 0. Now we get: Loop Unroll: F[main] Loop %no_exit Loop Size = 2 Trip Count = 2147483648 - TOO LARGE: 4294967296>100 Thanks to some anonymous person playing with the demo page that repeatedly caused zion to go into swapping land. That's one way to ensure you'll get a quick bugfix. :) Testcase here: Transforms/LoopUnroll/2004-05-13-DontUnrollTooMuch.ll llvm-svn: 13564
* Do not pass in the same argument to the extracted function more than once, andChris Lattner2004-05-121-1/+8
| | | | | | give the extracted function a more useful name than just foo_code. llvm-svn: 13493
* Implement support for code extracting basic blocks that have a returnChris Lattner2004-05-121-2/+12
| | | | | | instruction in them. llvm-svn: 13490
* Implement splitting of PHI nodes, allowing block extraction of BB's that haveChris Lattner2004-05-121-7/+96
| | | | | | | | | | PHI node entries from multiple outside-the-region blocks. This also fixes extraction of the entry block in a function. Yaay. This has successfully block extracted all (but one) block from the score_move function in obsequi (out of 33). Hrm, I wonder which block the bug is in. :) llvm-svn: 13489
* * 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
OpenPOWER on IntegriCloud