summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit message (Collapse)AuthorAgeFilesLines
* simplify some logic furtherChris Lattner2005-09-231-6/+1
| | | | llvm-svn: 23408
* pull a bunch of logic out of SimplifyCFG into a helper fnChris Lattner2005-09-231-112/+112
| | | | llvm-svn: 23407
* Start threading across blocks with code in them, so long as the code doesChris Lattner2005-09-201-15/+64
| | | | | | | | | not define a value that is used outside of it's block. This catches many more simplifications, e.g. 854 in 176.gcc, 137 in vpr, etc. This implements branch-phi-thread.ll:test3.ll llvm-svn: 23397
* Implement merging of blocks with the same condition if the block has multipleChris Lattner2005-09-201-21/+59
| | | | | | predecessors. This implements branch-phi-thread.ll::test1 llvm-svn: 23395
* Reject a case we don't handle yetChris Lattner2005-09-191-1/+3
| | | | llvm-svn: 23393
* remove debugging code :-/Chris Lattner2005-09-191-2/+0
| | | | llvm-svn: 23392
* Implement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threadingChris Lattner2005-09-191-0/+73
| | | | | | | control across branches with determined outcomes. More generality to follow. This triggers a couple thousand times in specint. llvm-svn: 23391
* Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem thatChris Lattner2005-08-031-2/+3
| | | | | | occurred while bugpointing another testcase llvm-svn: 22621
* Finally, add the required constraint checks to fix ↵Chris Lattner2005-08-031-2/+29
| | | | | | | | Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll the right way llvm-svn: 22615
* Simplify some code, add the correct pred checksChris Lattner2005-08-031-16/+25
| | | | llvm-svn: 22613
* Refactor code out of PropagatePredecessorsForPHIs, turning it into a pure ↵Chris Lattner2005-08-031-37/+36
| | | | | | function with no side-effects llvm-svn: 22612
* use splice instead of remove/insert to avoid some symtab operationsChris Lattner2005-08-031-2/+2
| | | | llvm-svn: 22611
* move two functions up in the file, use SafeToMergeTerminators to eliminateChris Lattner2005-08-031-61/+45
| | | | | | some duplicated code llvm-svn: 22610
* Rip some code out of the main SimplifyCFG function into a subfunction andChris Lattner2005-08-031-78/+72
| | | | | | call it from the only place it is live. No functionality changes. llvm-svn: 22609
* Disable this patch:Chris Lattner2005-08-021-1/+1
| | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050801/027345.html This breaks real programs and only fixes an obscure regression testcase. A real fix is in development. llvm-svn: 22606
* Change a place to use an arbitrary value instead of null, when possibleChris Lattner2005-08-021-3/+3
| | | | llvm-svn: 22605
* This code was very close, but not quite right. It did not take intoChris Lattner2005-08-021-3/+10
| | | | | | | | consideration the case where a reference in an unreachable block could occur. This fixes Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll, something I ran into while bugpoint'ing another pass. llvm-svn: 22584
* Don't crash on: X = phi (X, X).Chris Lattner2005-06-171-6/+9
| | | | | | This fixes PR584 and Transforms/SimplifyCFG/2005-06-16-PHICrash.ll llvm-svn: 22232
* Fix Transforms/SimplifyCFG/switch-simplify-crash.llChris Lattner2005-05-201-0/+7
| | | | llvm-svn: 22158
* Make sure to preserve the calling convention when changing an invoke intoChris Lattner2005-05-141-0/+2
| | | | | | | a call. This fixes Prolangs-C++/deriv2, kimwitu++, and Misc-C++/bigfib on X86 with -enable-x86-fastcc. llvm-svn: 22023
* Remove trailing whitespaceMisha Brukman2005-04-211-39/+39
| | | | llvm-svn: 21427
* Teach simplifycfg that setcc is cheap and non-trapping, so that it canChris Lattner2005-04-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | convert this: %tmp.1 = seteq int %i, 0 ; <bool> [#uses=1] br bool %tmp.1, label %shortcirc_done, label %shortcirc_next shortcirc_next: ; preds = %entry %tmp.4 = seteq int %j, 0 ; <bool> [#uses=1] br label %shortcirc_done shortcirc_done: ; preds = %shortcirc_next, %entry %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ] ; <bool> [#uses=1] to this: %tmp.1 = seteq int %i, 0 ; <bool> [#uses=1] %tmp.4 = seteq int %j, 0 ; <bool> [#uses=1] %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4 ; <bool> [#uses=1] ... which is later simplified by instcombine into an or. llvm-svn: 21388
* Get rid of this for_each loopChris Lattner2005-04-121-2/+2
| | | | llvm-svn: 21253
* Fix spelling, patch contributed by Gabor Greif!Chris Lattner2005-02-271-1/+1
| | | | llvm-svn: 20343
* remove extraneous castChris Lattner2005-02-261-2/+1
| | | | llvm-svn: 20334
* Implement Transforms/SimplifyCFG/switch_thread.llChris Lattner2005-02-241-4/+190
| | | | | | | | This does a simple form of "jump threading", which eliminates CFG edges that are provably dead. This triggers 90 times in the external tests, and eliminating CFG edges is always always a good thing! :) llvm-svn: 20300
* switchinst ctor now takes a hint for the number of cases that it will have.Chris Lattner2005-01-291-2/+2
| | | | llvm-svn: 19898
* Implement SimplifyCFG/DeadSetCC.llChris Lattner2005-01-011-0/+8
| | | | | | | | SimplifyCFG is one of those passes that we use for final cleanup: it should not rely on other passes to clean up its garbage. This fixes the "why are trivially dead setcc's in the output of gccas" problem. llvm-svn: 19212
* Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,Chris Lattner2004-12-101-14/+13
| | | | | | and the failure on make_dparser last night. llvm-svn: 18766
* Squelch warningChris Lattner2004-11-301-1/+1
| | | | llvm-svn: 18381
* Alkis noticed that this variable is dead. Thanks!Chris Lattner2004-11-301-2/+0
| | | | llvm-svn: 18369
* If we have something like this:Chris Lattner2004-11-301-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | if (x) { code ... } else { code ... } Turn it into: code if (x) { ... } else { ... } This reduces code size and in some common cases allows us to completely eliminate the conditional. This turns several if/then/else blocks in loops into straightline code in 179.art, turning the loops into single basic blocks (good for modsched even!). Maybe now brg will leave me alone ;-) llvm-svn: 18366
* Do not compute the predecessor list for a block unless we need it.Chris Lattner2004-11-011-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up simplifycfg on this program, from 44.87s to 0.29s (with a profiled build): #define CL0(a) case a: goto c; #define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \ CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9) #define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \ CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9) #define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \ CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9) #define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \ CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9) void f(); void a() { int b; c: switch (b) { CL4(1) } } This testcase is contrived to expose N^2 behavior, but this patch should speedup simplifycfg on any programs that use large switch statements. This testcase comes from GCC PR17895. llvm-svn: 17389
* Eliminate compilation warning on uninitialized variable.Reid Spencer2004-10-221-1/+1
| | | | llvm-svn: 17163
* Simplify code by deleting instructions that preceed unreachable instructions.Chris Lattner2004-10-181-1/+101
| | | | | | | Simplify code by simplifying terminators that branch to blocks that start with an unreachable instruction. llvm-svn: 17116
* When converting phi nodes into select instructions, we shouldn't promote PHIChris Lattner2004-10-141-41/+93
| | | | | | | | nodes unless we KNOW that we are able to promote all of them. This fixes: test/Regression/Transforms/SimplifyCFG/PhiNoEliminate.ll llvm-svn: 16973
* Do not insert trivially dead select instructions, which allows us toChris Lattner2004-09-291-2/+11
| | | | | | potentially fold more in one pass. llvm-svn: 16583
* Convert code to compile with vc7.1.Reid Spencer2004-09-151-8/+11
| | | | | | Patch contributed by Paolo Invernizzi. Thanks Paolo! llvm-svn: 16368
* Fixes to make LLVM compile with vc7.1.Alkis Evlogimenos2004-09-031-1/+1
| | | | | | Patch contributed by Paolo Invernizzi! llvm-svn: 16152
* Changes For Bug 352Reid Spencer2004-09-011-1/+1
| | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. llvm-svn: 16137
* These files don't need to include <iostream> since they include ↵Brian Gaeke2004-07-211-1/+0
| | | | | | "Support/Debug.h". llvm-svn: 15089
* Implement SimplifyCFG/BrUnwind.llChris Lattner2004-07-201-2/+9
| | | | llvm-svn: 15022
* bug 122:Reid Spencer2004-07-181-2/+1
| | | | | | - Minimize redundant isa<GlobalValue> usage llvm-svn: 14948
* Progress on PR341Chris Lattner2004-07-151-3/+3
| | | | llvm-svn: 14840
* Add #include <iostream> since Value.h does not #include it any more.Reid Spencer2004-07-041-0/+2
| | | | llvm-svn: 14622
* *FINALLY* Fix a really nasty nondeterministic bug that has been haunting usChris Lattner2004-06-211-6/+7
| | | | | | | | | | | since May 1st. In this code, the pred iterator was being invalidated sometimes causing the wrong entries to be added to PHI nodes. The fix for this is to defererence and safe the *PI value before we hack on branch instructions, which changes use/def chains, which SOMETIMES invalidates the iterator. llvm-svn: 14278
* Add some DEBUG output to the simplifycfg routinesChris Lattner2004-06-201-14/+13
| | | | | | | Fix another non-deterministic behavior, this one should actually speed up the code though as it was doing silly things. llvm-svn: 14258
* Do not sort by the address of LLVM ConstantInt* objects. This producesChris Lattner2004-06-191-10/+21
| | | | | | | | | | | | | | | | | | | | | | nondeterministic results that depend on where these objects land in memory. Instead, sort by the value of the constant, which is stable. Before this patch, the -simplifycfg pass run from two different compilers could cause different code to be generated, though it was semantically the same: @@ -12258,8 +12258,8 @@ %s_addr.1 = phi sbyte* [ %s, %entry ], [ %inc.0, %no_exit ] ; <sbyte*> [#uses=5] %tmp.1 = load sbyte* %s_addr.1 ; <sbyte> [#uses=1] switch sbyte %tmp.1, label %no_exit [ - sbyte 0, label %loopexit sbyte 46, label %loopexit + sbyte 0, label %loopexit ] We need to stomp all of this stuff out. llvm-svn: 14243
* 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