summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG
Commit message (Collapse)AuthorAgeFilesLines
...
* remove autoupgrade support for really old-style debug info intrinsics.Chris Lattner2011-11-276-419/+0
| | | | | | | I think this is the last of autoupgrade that can be removed in 3.1. Can the atomic upgrade stuff also go? llvm-svn: 145169
* FileCheck-ize this test and make it more precise. This is in preparationChandler Carruth2011-11-261-5/+11
| | | | | | for adding other tests. llvm-svn: 145143
* Replace more uses of 'unwind' in the tests with calls to landingpad andBill Wendling2011-09-191-16/+4
| | | | | | resume. Note that some of these tests were basically dead. llvm-svn: 140076
* Delete trivial landing pads that just continue unwinding the caughtDuncan Sands2011-09-051-0/+22
| | | | | | exception. llvm-svn: 139117
* Try to eliminate the use of the 'unwind' instruction.Bill Wendling2011-09-025-6/+10
| | | | llvm-svn: 139046
* Update tests to new EH model. Add landingpad instructions to landing pads.Bill Wendling2011-08-295-0/+33
| | | | llvm-svn: 138759
* SimplifyCFG: If we have a PHI node that can evaluate to NULL and do a load ↵Benjamin Kramer2011-08-261-0/+87
| | | | | | | | | | or store to the address returned by the PHI node then we can consider this incoming value as dead and remove the edge pointing there, unless there are instructions that can affect control flow executed in between. In theory this could be extended to other instructions, eg. division by zero, but it's likely that it will "miscompile" some code because people depend on div by zero not trapping. NULL pointer dereference usually leads to a crash so we should be on the safe side. This shrinks the size of a Release clang by 16k on x86_64. llvm-svn: 138618
* Update SimplifyCFG for atomic operations.Eli Friedman2011-08-151-0/+43
| | | | | | | | This commit includes a mention of the landingpad instruction, but it's not changing the behavior around it. I think the current behavior is correct, though. Bill, can you double-check that? llvm-svn: 137691
* Move "atomic" and "volatile" designations on instructions after the opcodeEli Friedman2011-08-121-4/+4
| | | | | | | | | | of the instruction. Note that this change affects the existing non-atomic load and store instructions; the parser now accepts both forms, and the change is noted in the release notes. llvm-svn: 137527
* more tests not making the jump into the brave new world.Chris Lattner2011-07-092-183/+0
| | | | llvm-svn: 134820
* Add r134057 back, but splice the predecessor after the successors phiRafael Espindola2011-06-301-0/+29
| | | | | | | | | nodes. Original message: Let simplify cfg simplify bb with only debug and lifetime intrinsics. llvm-svn: 134182
* Temporarily revert r134057: "Let simplify cfg simplify bb with only debug and Chad Rosier2011-06-291-29/+0
| | | | | | lifetime intrinsics" due to buildbot failures. llvm-svn: 134071
* Let simplify cfg simplify bb with only debug and lifetime intrinsics.Rafael Espindola2011-06-291-0/+29
| | | | llvm-svn: 134057
* Fix PR10103: Less code for enum type translation.Hans Wennborg2011-06-182-1/+37
| | | | | | | | | | | In cases such as the attached test, where the case value for a switch destination is used in a phi node that follows the destination, it might be better to replace that value with the condition value of the switch, so that more blocks can be folded away with TryToSimplifyUncondBranchFromEmptyBlock because there are less conflicts in the phi node. llvm-svn: 133344
* remove parser support for the obsolete "multiple return values" syntax, whichChris Lattner2011-06-172-73/+0
| | | | | | was replaced with return of a "first class aggregate". llvm-svn: 133245
* If the block that we're threading through is jumped to by an indirect branch,Bill Wendling2011-06-041-0/+69
| | | | | | | | | | | | then we don't want to set the destination in the indirect branch to the destination. This is because the indirect branch needs its destinations to have had their block addresses taken. This isn't so of the new critical edge that's split during this process. If it turns out that the destination block has only one predecessor, and that being a BB with an indirect branch, then it won't be marked as 'used' and may be removed. PR10072 llvm-svn: 132638
* Add a parameter to ConstantFoldTerminator() that callers can use to ask it ↵Frits van Bommel2011-05-221-0/+52
| | | | | | | | to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior. I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this. llvm-svn: 131855
* Add test for PR9946.Rafael Espindola2011-05-191-0/+18
| | | | llvm-svn: 131621
* SimplifyCFG: Use ComputeMaskedBits to prune dead cases from switch instructions.Benjamin Kramer2011-05-141-0/+38
| | | | llvm-svn: 131345
* SimplifyCFG: Expose phi node folding cost threshold as command line parameterPeter Collingbourne2011-04-291-0/+34
| | | | llvm-svn: 130528
* SimplifyCFG: Add CostRemaining parameter to DominatesMergePointPeter Collingbourne2011-04-291-0/+1
| | | | llvm-svn: 130527
* SimplifyCFG: Add Trunc, ZExt and SExt to the list of cheap instructions for ↵Peter Collingbourne2011-04-291-6/+9
| | | | | | phi node folding llvm-svn: 130526
* Simplify cfg inserts a call to trap when unreachable code is detected. ↵Devang Patel2011-04-271-0/+19
| | | | | | Assign DebugLoc to this new trap instruction. llvm-svn: 130315
* Improve the bail-out predicate to really only kick in when phiChris Lattner2011-04-261-3/+1
| | | | | | | translation fails. We were bailing out in some cases that would cause us to miss GVN'ing some non-local cases away. llvm-svn: 130206
* Do not let debug info interfer with branch folding.Devang Patel2011-04-071-0/+58
| | | | llvm-svn: 129114
* While hoisting common code from if/else, hoist debug info intrinsics if they ↵Devang Patel2011-04-071-0/+53
| | | | | | match. llvm-svn: 129078
* PR9450: Make switch optimization in SimplifyCFG not dependent on the orderingEli Friedman2011-03-151-8/+48
| | | | | | of pointers in an std::map. llvm-svn: 127650
* Fix mistyped CHECK lines.Benjamin Kramer2011-03-091-1/+1
| | | | llvm-svn: 127366
* PR9420; an instruction before an unreachable is guaranteed not to have anyEli Friedman2011-03-091-0/+31
| | | | | | | | reachable uses, but there still might be uses in dead blocks. Use the standard solution of replacing all the uses with undef. This is a rare case because it's very sensitive to phase ordering in SimplifyCFG. llvm-svn: 127299
* Teach SimplifyCFG that (switch (select cond, X, Y)) is better expressed as a ↵Frits van Bommel2011-02-281-0/+138
| | | | | | | | branch. Based on a patch by Alistair Lynn. llvm-svn: 126647
* Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap."Benjamin Kramer2011-02-251-1/+1
| | | | | | | Yes, there are other types than i8* and GEPs on them can produce an add+multiply. We don't consider that cheap enough to be speculatively executed. llvm-svn: 126481
* SimplifyCFG: GEPs with just one non-constant index are also cheap.Benjamin Kramer2011-02-241-2/+22
| | | | llvm-svn: 126452
* SimplifyCFG: GEPs with constant indices are cheap enough to be executed ↵Benjamin Kramer2011-02-241-0/+20
| | | | | | unconditionally. llvm-svn: 126445
* SimplifyCFG: Track the number of used icmps when turning a icmp chain into a ↵Benjamin Kramer2011-02-073-10/+30
| | | | | | | | switch. If we used only one icmp, don't turn it into a switch. Also prevent the switch-to-icmp transform from creating identity adds, noticed by Marius Wachtler. llvm-svn: 125056
* SimplifyCFG: Also transform switches that represent a range comparison but ↵Benjamin Kramer2011-02-031-0/+40
| | | | | | | | are not sorted into sub+icmp. This transforms another 1000 switches in gcc.c. llvm-svn: 124826
* SimplifyCFG: Turn switches into sub+icmp+branch if possible.Benjamin Kramer2011-02-022-22/+7
| | | | | | | | | | | | | | | | | This makes the job of the later optzn passes easier, allowing the vast amount of icmp transforms to chew on it. We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting binary on i386-linux. The testcase from README.txt now compiles into decl %edi cmpl $3, %edi sbbl %eax, %eax andl $1, %eax ret llvm-svn: 124724
* Re-apply r124518 with fix. Watch out for invalidated iterator.Evan Cheng2011-01-294-15/+38
| | | | llvm-svn: 124526
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-294-38/+15
| | | | llvm-svn: 124522
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-294-15/+38
| | | | | | unconditional predecessor to enable TCE on demand. llvm-svn: 124518
* Revert r124462. There are a few big regressions that I need to fix first.Evan Cheng2011-01-284-38/+15
| | | | llvm-svn: 124478
* - Stop simplifycfg from duplicating "ret" instructions into unconditionalEvan Cheng2011-01-284-15/+38
| | | | | | | | branches. PR8575, rdar://5134905, rdar://8911460. - Allow codegen tail duplication to dup small return blocks after register allocation is done. llvm-svn: 124462
* SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.Benjamin Kramer2010-12-171-0/+20
| | | | llvm-svn: 122054
* improve switch formation to handle small range Chris Lattner2010-12-171-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | comparisons formed by comparisons. For example, this: void foo(unsigned x) { if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) bar(); } compiles into: _foo: ## @foo ## BB#0: ## %entry cmpl $6, %edi ja LBB0_2 ## BB#1: ## %entry movl %edi, %eax movl $91, %ecx btq %rax, %rcx jb LBB0_3 instead of: _foo: ## @foo ## BB#0: ## %entry cmpl $2, %edi jb LBB0_4 ## BB#1: ## %switch.early.test cmpl $6, %edi ja LBB0_3 ## BB#2: ## %switch.early.test movl %edi, %eax movl $88, %ecx btq %rax, %rcx jb LBB0_4 This catches a bunch of cases in GCC, which look like this: %804 = load i32* @which_alternative, align 4, !tbaa !0 %805 = icmp ult i32 %804, 2 %806 = icmp eq i32 %804, 3 %or.cond121 = or i1 %805, %806 %807 = icmp eq i32 %804, 4 %or.cond124 = or i1 %or.cond121, %807 br i1 %or.cond124, label %.thread, label %808 turning this into a range comparison. llvm-svn: 122045
* - Insert new instructions before DomBlock's terminator,Chris Lattner2010-12-142-30/+16
| | | | | | | | | | which is simpler than finding a place to insert in BB. - Don't perform the 'if condition hoisting' xform on certain i1 PHIs, as it interferes with switch formation. This re-fixes "example 7", without breaking the world hopefully. llvm-svn: 121764
* fix two significant issues with FoldTwoEntryPHINode:Chris Lattner2010-12-141-2/+5
| | | | | | | | | | | | | first, it can kick in on blocks whose conditions have been folded to a constant, even though one of the edges will be trivially folded. second, it doesn't clean up the "if diamond" that it just eliminated away. This is a problem because other simplifycfg xforms kick in depending on the order of block visitation, causing pointless work. llvm-svn: 121762
* fix yet anohter broken lineChris Lattner2010-12-141-2/+2
| | | | llvm-svn: 121750
* reapply my recent change that disables a piece of the switch formationChris Lattner2010-12-141-2/+1
| | | | | | work, but fixes 400.perlbmk. llvm-svn: 121749
* Fix recent buildbot breakage by pulling SimplifyCFG back to its state as of ↵Owen Anderson2010-12-131-0/+1
| | | | | | | | r121694, the most recent state where I'm confident there were no crashes or miscompilations. XFAIL the test added since then for now. llvm-svn: 121733
* temporarily disable part of my previous patch, which causes an iterator ↵Chris Lattner2010-12-131-15/+36
| | | | | | invalidation issue, causing a crash on some versions of perlbmk. llvm-svn: 121728
* Fix sort predicate. qsort(3)'s predicate semantics differ from std::sort's. ↵Benjamin Kramer2010-12-131-0/+39
| | | | | | Fixes PR 8780. llvm-svn: 121705
OpenPOWER on IntegriCloud