summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert CallInst and InvokeInst APIs to use ArrayRef.Jay Foad2011-07-151-4/+2
| | | | llvm-svn: 135265
* Add r134057 back, but splice the predecessor after the successors phiRafael Espindola2011-06-301-1/+1
| | | | | | | | | 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-1/+1
| | | | | | lifetime intrinsics" due to buildbot failures. llvm-svn: 134071
* Let simplify cfg simplify bb with only debug and lifetime intrinsics.Rafael Espindola2011-06-291-1/+1
| | | | llvm-svn: 134057
* Fix PR10103: Less code for enum type translation.Hans Wennborg2011-06-181-0/+74
| | | | | | | | | | | 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
* If the block that we're threading through is jumped to by an indirect branch,Bill Wendling2011-06-041-1/+3
| | | | | | | | | | | | 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-1/+1
| | | | | | | | 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
* Reapply r131605. This time with a fix, which is to use NoFolder.Devang Patel2011-05-191-30/+34
| | | | llvm-svn: 131673
* revert 131605 to fix PR9946.Rafael Espindola2011-05-191-36/+31
| | | | llvm-svn: 131620
* Use IRBuilder.Devang Patel2011-05-191-2/+2
| | | | llvm-svn: 131609
* Use IRBuilder while simplifying unreachable.Devang Patel2011-05-191-7/+8
| | | | llvm-svn: 131607
* Use IRBuilder while simplifying conditional branch.Devang Patel2011-05-181-31/+36
| | | | llvm-svn: 131605
* Use IRBuilder while simplifying branch.Devang Patel2011-05-181-12/+13
| | | | llvm-svn: 131598
* Use IRBuilder while simplifying return instruction.Devang Patel2011-05-181-11/+13
| | | | llvm-svn: 131580
* Spread use of IRBuilder even more.Devang Patel2011-05-181-10/+12
| | | | llvm-svn: 131571
* Use IRBuilder while simplifying switch instruction.Devang Patel2011-05-181-15/+18
| | | | llvm-svn: 131566
* Use IRBuilder while simplifying unwind.Devang Patel2011-05-181-7/+9
| | | | llvm-svn: 131561
* Use IRBuilder while simplifying terminator.Devang Patel2011-05-181-4/+7
| | | | llvm-svn: 131552
* Use IRBuilder while simplifying unconditional branch.Devang Patel2011-05-181-6/+11
| | | | llvm-svn: 131551
* Use IRBuilder while folding two entry PHINode.Devang Patel2011-05-181-6/+8
| | | | llvm-svn: 131548
* Set up IRBuilder for use during simplification.Devang Patel2011-05-181-0/+3
| | | | llvm-svn: 131545
* Preseve line numbers while simplifying CFG.Devang Patel2011-05-171-6/+16
| | | | llvm-svn: 131508
* SimplifyCFG: Use ComputeMaskedBits to prune dead cases from switch instructions.Benjamin Kramer2011-05-141-1/+36
| | | | llvm-svn: 131345
* SimplifyCFG: Expose phi node folding cost threshold as command line parameterPeter Collingbourne2011-04-291-1/+6
| | | | llvm-svn: 130528
* SimplifyCFG: Add CostRemaining parameter to DominatesMergePointPeter Collingbourne2011-04-291-9/+38
| | | | llvm-svn: 130527
* SimplifyCFG: Add Trunc, ZExt and SExt to the list of cheap instructions for ↵Peter Collingbourne2011-04-291-0/+3
| | | | | | phi node folding llvm-svn: 130526
* rework FoldBranchToCommonDest to exit earlier when there is a bonusChris Lattner2011-04-141-39/+30
| | | | | | | | | | | | instruction around, reducing work. Greatly simplify handling of debug instructions. There is no need to build up a vector of them and then move them into the one predecessor if we're processing a block. Instead just rescan the block and *copy* them into the pred. If a block gets merged into multiple preds, this will retain more debug info. llvm-svn: 129502
* comment cleanup, use moveBefore instead of removeFromParent+insertBefore.Chris Lattner2011-04-111-9/+5
| | | | llvm-svn: 129319
* Do not let debug info interfer with branch folding.Devang Patel2011-04-071-0/+6
| | | | llvm-svn: 129114
* While hoisting common code from if/else, hoist debug info intrinsics if they ↵Devang Patel2011-04-071-8/+18
| | | | | | match. llvm-svn: 129078
* Simplify. isIdenticalToWhenDefined() checks opcode.Devang Patel2011-04-071-4/+2
| | | | llvm-svn: 129041
* While folding branch to a common destination into a predecessor, copy dbg ↵Devang Patel2011-04-061-4/+17
| | | | | | values also. llvm-svn: 129035
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-1/+1
| | | | | | PHINode::Create() giving the (known or expected) number of operands. llvm-svn: 128537
* (Almost) always call reserveOperandSpace() on newly created PHINodes.Jay Foad2011-03-301-1/+3
| | | | llvm-svn: 128535
* PR9450: Make switch optimization in SimplifyCFG not dependent on the orderingEli Friedman2011-03-151-7/+18
| | | | | | of pointers in an std::map. llvm-svn: 127650
* PR9420; an instruction before an unreachable is guaranteed not to have anyEli Friedman2011-03-091-1/+3
| | | | | | | | 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-1/+26
| | | | | | | | 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-5/+3
| | | | | | | 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-3/+5
| | | | llvm-svn: 126452
* SimplifyCFG: GEPs with constant indices are cheap enough to be executed ↵Benjamin Kramer2011-02-241-0/+5
| | | | | | unconditionally. llvm-svn: 126445
* SimplifyCFG: Track the number of used icmps when turning a icmp chain into a ↵Benjamin Kramer2011-02-071-7/+22
| | | | | | | | 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-6/+17
| | | | | | | | 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-021-0/+32
| | | | | | | | | | | | | | | | | 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-291-18/+7
| | | | llvm-svn: 124526
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-291-7/+18
| | | | llvm-svn: 124522
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-291-18/+7
| | | | | | 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-281-6/+1
| | | | llvm-svn: 124478
* - Stop simplifycfg from duplicating "ret" instructions into unconditionalEvan Cheng2011-01-281-1/+6
| | | | | | | | branches. PR8575, rdar://5134905, rdar://8911460. - Allow codegen tail duplication to dup small return blocks after register allocation is done. llvm-svn: 124462
* Factor the actual simplification out of SimplifyIndirectBrOnSelect and into ↵Frits van Bommel2011-01-111-26/+37
| | | | | | | | a new helper function so it can be reused in e.g. an upcoming SimplifySwitchOnSelect. No functional change. llvm-svn: 123234
* simplify this a bit.Chris Lattner2010-12-181-2/+1
| | | | llvm-svn: 122156
OpenPOWER on IntegriCloud