mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +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:
@ -40,7 +40,11 @@ namespace {
|
||||
initializeBreakCriticalEdgesPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
bool runOnFunction(Function &F) override {
|
||||
unsigned N = SplitAllCriticalEdges(F, this);
|
||||
NumBroken += N;
|
||||
return N > 0;
|
||||
}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.addPreserved<DominatorTreeWrapperPass>();
|
||||
@ -62,24 +66,6 @@ FunctionPass *llvm::createBreakCriticalEdgesPass() {
|
||||
return new BreakCriticalEdges();
|
||||
}
|
||||
|
||||
// runOnFunction - Loop over all of the edges in the CFG, breaking critical
|
||||
// edges as they are found.
|
||||
//
|
||||
bool BreakCriticalEdges::runOnFunction(Function &F) {
|
||||
bool Changed = false;
|
||||
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, this)) {
|
||||
++NumBroken;
|
||||
Changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return Changed;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Implementation of the external critical edge manipulation functions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user