mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Remove duplicate successors from indirectbr instructions before building the machine CFG.
This makes early tail duplication run 60 times faster when compiling the Firefox JavaScript interpreter, see PR6186. llvm-svn: 95831
This commit is contained in:
parent
e87a8a944d
commit
215d9f3898
@ -2062,9 +2062,15 @@ void SelectionDAGBuilder::visitSwitch(SwitchInst &SI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) {
|
void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) {
|
||||||
// Update machine-CFG edges.
|
// Update machine-CFG edges with unique successors.
|
||||||
|
std::vector<BasicBlock*> succs;
|
||||||
|
succs.reserve(I.getNumSuccessors());
|
||||||
for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i)
|
for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i)
|
||||||
CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]);
|
succs.push_back(I.getSuccessor(i));
|
||||||
|
std::sort(succs.begin(), succs.end());
|
||||||
|
succs.erase(std::unique(succs.begin(), succs.end()), succs.end());
|
||||||
|
for (unsigned i = 0, e = succs.size(); i != e; ++i)
|
||||||
|
CurMBB->addSuccessor(FuncInfo.MBBMap[succs[i]]);
|
||||||
|
|
||||||
DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(),
|
DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(),
|
||||||
MVT::Other, getControlRoot(),
|
MVT::Other, getControlRoot(),
|
||||||
|
Loading…
Reference in New Issue
Block a user