[llvm-commits] [llvm] r95831 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Chris Lattner
clattner at apple.com
Wed Feb 10 16:48:45 PST 2010
On Feb 10, 2010, at 4:34 PM, Jakob Stoklund Olesen wrote:
> Author: stoklund
> Date: Wed Feb 10 18:34:18 2010
> New Revision: 95831
>
> URL: http://llvm.org/viewvc/llvm-project?rev=95831&view=rev
> Log:
> 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.
Nice speedup! Please use SmallVector and array_pod_sort instead of vector and sort,
-Chris
>
> Modified:
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=95831&r1=95830&r2=95831&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Feb 10 18:34:18 2010
> @@ -2062,9 +2062,15 @@
> }
>
> 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)
> - 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(),
> MVT::Other, getControlRoot(),
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list