summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a crashing bug in SplitBlock when it is called on a block with noRafael Espindola2011-08-241-5/+6
| | | | | | | | dominator information even though dominators were previously computed. Patch by Nick Sumner. llvm-svn: 138449
* If we're splitting the landing pad block and assigning it only one predecessor,Bill Wendling2011-08-191-26/+40
| | | | | | then don't split it a second time, since that block will be dead. llvm-svn: 138153
* Add SplitLandingPadPredecessors().Bill Wendling2011-08-191-1/+95
| | | | | | | | | | | | | | | | SplitLandingPadPredecessors is similar to SplitBlockPredecessors in that it splits the current block and attaches a set of predecessors to the new basic block. However, it differs from SplitBlockPredecessors in that it's specifically designed to handle landing pad blocks. Two new basic blocks are created: one that is has the vector of predecessors as its predecessors and one that has the remaining predecessors as its predecessors. Those two new blocks then receive a cloned copy of the landingpad instruction from the original block. The landingpad instructions are joined in a PHI, etc. Like SplitBlockPredecessors, it updates the LLVM IR, AliasAnalysis, DominatorTree, DominanceFrontier, LoopInfo, and LCCSA analyses. llvm-svn: 138014
* Split out the updating of PHI nodes after splitting the BB into a separateBill Wendling2011-08-181-43/+53
| | | | | | function. llvm-svn: 137979
* Use this fantzy ArrayRef thing to pass in the list of predecessors.Bill Wendling2011-08-181-9/+14
| | | | llvm-svn: 137978
* Use static instead of anonymous namespace.Bill Wendling2011-08-181-7/+4
| | | | llvm-svn: 137959
* Split out the analysis updating code into a helper function. No intendedBill Wendling2011-08-181-63/+78
| | | | | | functionality change. llvm-svn: 137926
* Increment the insertion iterator to beyond the landingpad instruction.Bill Wendling2011-08-171-1/+1
| | | | llvm-svn: 137872
* Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad2011-06-231-3/+3
| | | | | | -Wshorten-64-to-32 warning in Instructions.h. llvm-svn: 133708
* Revert r133513:Eric Christopher2011-06-231-3/+3
| | | | | | | | | "Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)." Due to some additional warnings. llvm-svn: 133700
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-211-3/+3
| | | | | | self-hosted build failure has been fixed (r133512). llvm-svn: 133513
* Revert r133435 and r133449 to appease buildbots.Chad Rosier2011-06-211-3/+3
| | | | llvm-svn: 133499
* Change how PHINodes store their operands.Jay Foad2011-06-201-3/+3
| | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) llvm-svn: 133435
* Scanning entire basic block may be too expensive in terms of compile time. ↵Devang Patel2011-05-021-6/+4
| | | | | | Instead, just use whatever location info first non-phi instruction has. llvm-svn: 130729
* Assing line number info to new PHIs created by SSA updater.Devang Patel2011-04-291-0/+12
| | | | llvm-svn: 130551
* Remove PHINode::reserveOperandSpace(). Instead, add a parameter toJay Foad2011-03-301-2/+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-0/+1
| | | | llvm-svn: 128535
* Re-apply r124518 with fix. Watch out for invalidated iterator.Evan Cheng2011-01-291-3/+28
| | | | llvm-svn: 124526
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-291-28/+3
| | | | llvm-svn: 124522
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-291-3/+28
| | | | | | unconditional predecessor to enable TCE on demand. llvm-svn: 124518
* Remove code for updating dominance frontiers and some outdated references toCameron Zwarich2011-01-181-12/+5
| | | | | | dominance and post-dominance frontiers. llvm-svn: 123725
* Fix a non-deterministic loop in llvm::MergeBlockIntoPredecessor.Jakob Stoklund Olesen2011-01-111-2/+2
| | | | | | | | | DT->changeImmediateDominator() trivially ignores identity updates, so there is really no need for the uniqueing provided by SmallPtrSet. I expect this to fix PR8954. llvm-svn: 123286
* when MergeBlockIntoPredecessor merges two blocks, update MemDep if itChris Lattner2011-01-111-0/+4
| | | | | | is floating around in the ether. llvm-svn: 123223
* Fix FoldSingleEntryPHINodes to update memdep and AA when it deletesChris Lattner2011-01-111-3/+19
| | | | | | | | | | phi nodes. It is called from MergeBlockIntoPredecessor which is called from GVN, which claims to preserve these. I'm skeptical that this is the actual problem behind PR8954, but this is a stab in the right direction. llvm-svn: 123222
* various code cleanups, enhance MergeBlockIntoPredecessor to preserveChris Lattner2011-01-081-13/+10
| | | | | | loop info. llvm-svn: 123074
* reduce nesting.Chris Lattner2011-01-081-6/+6
| | | | llvm-svn: 123071
* split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner2011-01-021-1/+1
| | | | | | so that Dominators.h is *just* domtree. Also prune #includes a bit. llvm-svn: 122714
* remove the dead (and terrible) llvm::RemoveSuccessor function.Chris Lattner2010-12-141-46/+0
| | | | llvm-svn: 121753
* typoesGabor Greif2010-09-101-1/+1
| | | | llvm-svn: 113647
* fit in 80 colsChris Lattner2010-08-181-2/+3
| | | | llvm-svn: 111348
* Use the getUniquePredecessor() utility function, instead of doingDan Gohman2010-08-171-15/+5
| | | | | | what it does manually. llvm-svn: 111248
* Move FindAvailableLoadedValue isSafeToLoadUnconditionally out ofDan Gohman2010-05-281-118/+0
| | | | | | | lib/Transforms/Utils and into lib/Analysis so that Analysis passes can use them. llvm-svn: 104949
* Code clean up.Evan Cheng2010-04-051-12/+10
| | | | llvm-svn: 100467
* Rename SuccessorNumber to GetSuccessorNumber.Bob Wilson2010-02-161-5/+6
| | | | llvm-svn: 96387
* Refactor to share code to find the position of a basic block successor in theBob Wilson2010-02-161-11/+17
| | | | | | terminator's list of successors. llvm-svn: 96377
* No need to look through bitcasts for DbgInfoIntrinsicVictor Hernandez2010-01-211-5/+0
| | | | llvm-svn: 94114
* Make RecursivelyDeleteTriviallyDeadInstructions,Dan Gohman2010-01-051-2/+5
| | | | | | | RecursivelyDeleteDeadPHINode, and DeleteDeadPHIs return a flag indicating whether they made any changes. llvm-svn: 92732
* Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer2010-01-051-1/+1
| | | | | | dereference the type pointer. llvm-svn: 92726
* Remove dead debug info intrinsics.Devang Patel2010-01-051-13/+0
| | | | | | | | | | Intrinsic::dbg_stoppoint Intrinsic::dbg_region_start Intrinsic::dbg_region_end Intrinsic::dbg_func_start AutoUpgrade simply ignores these intrinsics now. llvm-svn: 92557
* Remove unnecessary #include "llvm/LLVMContext.h".Nick Lewycky2009-12-081-1/+0
| | | | llvm-svn: 90836
* Add an assertion to catch indirectbr in SplitBlockPredecessors. ThisDan Gohman2009-11-051-2/+6
| | | | | | | | | | | | makes several optimization passes abort in cases where they're currently silently miscompiling code. Remove the indirectbr assertion from SplitEdge. Indirectbr is only a problem for critical edges, and SplitEdge defers to SplitCriticalEdge to handle those, and SplitCriticalEdge has its own assertion for indirectbr. llvm-svn: 86147
* change llvm::MergeBlockIntoPredecessor to not merge two blocks BB1->BB2 Chris Lattner2009-11-011-3/+7
| | | | | | | | | when BB2 has its address taken. Since it ends up doing BB2->rauw(BB1), this can cause the address of the entry block to be taken. Since it is generally undesirable to nuke blocks whose address is taken, even when we can, just unconditionally stop this xform. llvm-svn: 85708
* llvm::SplitEdge should refuse to split an edge from an indirectbr.Chris Lattner2009-10-311-0/+2
| | | | | | Fix CodeGenPrepare to not try to split edges from indirectbr. llvm-svn: 85690
* Revert r85667. LoopUnroll currently can't call utility functions whichDan Gohman2009-10-311-23/+47
| | | | | | | auto-update the DominatorTree because it doesn't keep the DominatorTree current while it works. llvm-svn: 85670
* Remove redundant code.Dan Gohman2009-10-311-3/+0
| | | | llvm-svn: 85668
* Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor intoDan Gohman2009-10-311-47/+23
| | | | | | | MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive, and makes it unnecessary for LoopUnroll to have its own copy of this code. llvm-svn: 85667
* Factor out redundancy from clone() implementations.Devang Patel2009-10-271-1/+1
| | | | llvm-svn: 85327
* Fix SplitBlockPredecessors' LoopInfo updating code to handle the caseDan Gohman2009-10-191-8/+20
| | | | | | | | where a loop's header is being split and it has predecessors which are not contained by the most-nested loop which contains the loop. This fixes PR5235. llvm-svn: 84505
* Instruction::clone does not need to take an LLVMContext&. Remove that andNick Lewycky2009-09-271-1/+1
| | | | | | update all the callers. llvm-svn: 82889
* Re-apply r80926, with fixes: keep the domtree informed of new blocksDan Gohman2009-09-081-23/+69
| | | | | | | | | | | | | | | that get created during loop unswitching, and fix SplitBlockPredecessors' LCSSA updating code to create new PHIs instead of trying to just move existing ones. Also, optimize Loop::verifyLoop, since it gets called a lot. Use searches on a sorted list of blocks instead of calling the "contains" function, as is done in other places in the Loop class, since "contains" does a linear search. Also, don't call verifyLoop from LoopSimplify or LCSSA, as the PassManager is already calling verifyLoop as part of LoopInfo's verifyAnalysis. llvm-svn: 81221
OpenPOWER on IntegriCloud