mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
Introduce llvm::SplitAllCriticalEdges
Summary: move the code from BreakCriticalEdges::runOnFunction() into a separate utility function llvm::SplitAllCriticalEdges() so that it can be used independently. No functionality change intended. Test Plan: check-llvm Reviewers: nlewycky Reviewed By: nlewycky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6313 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222288 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -265,6 +265,18 @@ BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, Pass *P) {
|
||||
return SplitBlock(BB, BB->getTerminator(), P);
|
||||
}
|
||||
|
||||
unsigned llvm::SplitAllCriticalEdges(Function &F, Pass *P) {
|
||||
unsigned NumBroken = 0;
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||
TerminatorInst *TI = I->getTerminator();
|
||||
if (TI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(TI))
|
||||
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
|
||||
if (SplitCriticalEdge(TI, i, P))
|
||||
++NumBroken;
|
||||
}
|
||||
return NumBroken;
|
||||
}
|
||||
|
||||
/// SplitBlock - Split the specified block at the specified instruction - every
|
||||
/// thing before SplitPt stays in Old and everything starting with SplitPt moves
|
||||
/// to a new block. The two blocks are joined by an unconditional branch and
|
||||
|
||||
Reference in New Issue
Block a user