From 8ecffa996aecec8501e03e0c3fa271b84d6fc4d3 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 8 Jun 2007 00:02:08 +0000 Subject: [PATCH] Do not preserve ETForest. llvm-svn: 37506 --- .../llvm/Transforms/Utils/BasicBlockUtils.h | 18 +++++------ .../Transforms/Utils/BreakCriticalEdges.cpp | 31 +++---------------- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h index 9c49c5e68567..4939111b88b1 100644 --- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -61,15 +61,15 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, bool AllowIdenticalEdges = false); /// SplitCriticalEdge - If this edge is a critical edge, insert a new node to -/// split the critical edge. This will update ETForest, ImmediateDominator, -/// DominatorTree, and DominatorFrontier information if it is available, thus -/// calling this pass will not invalidate either of them. This returns true if -/// the edge was split, false otherwise. If MergeIdenticalEdges is true (the -/// default), *all* edges from TI to the specified successor will be merged into -/// the same critical edge block. This is most commonly interesting with switch -/// instructions, which may have many edges to any one destination. This -/// ensures that all edges to that dest go to one block instead of each going to -/// a different block, but isn't the standard definition of a "critical edge". +/// split the critical edge. This will update DominatorTree, and DominatorFrontier +/// information if it is available, thus calling this pass will not invalidate +/// either of them. This returns true if the edge was split, false otherwise. +/// If MergeIdenticalEdges is true (the default), *all* edges from TI to the +/// specified successor will be merged into the same critical edge block. +/// This is most commonly interesting with switch instructions, which may +/// have many edges to any one destination. This ensures that all edges to that +/// dest go to one block instead of each going to a different block, but isn't +/// the standard definition of a "critical edge". /// bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0, bool MergeIdenticalEdges = false); diff --git a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp index 6ceea34270f5..af9a114bbebf 100644 --- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -40,7 +40,6 @@ namespace { virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); @@ -110,11 +109,11 @@ bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, } // SplitCriticalEdge - If this edge is a critical edge, insert a new node to -// split the critical edge. This will update ETForest, ImmediateDominator, -// DominatorTree, and DominatorFrontier information if it is available, thus -// calling this pass will not invalidate any of them. This returns true if -// the edge was split, false otherwise. This ensures that all edges to that -// dest go to one block instead of each going to a different block. +// split the critical edge. This will update DominatorTree, and DominatorFrontier +// information if it is available, thus calling this pass will not invalidate +// any of them. This returns true if the edge was split, false otherwise. +// This ensures that all edges to that dest go to one block instead of each +// going to a different block. // bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P, bool MergeIdenticalEdges) { @@ -181,26 +180,6 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P, bool NewBBDominatesDestBB = true; - // Update the forest? - if (ETForest *EF = P->getAnalysisToUpdate()) { - // NewBB is dominated by TIBB. - EF->addNewBlock(NewBB, TIBB); - - // If NewBBDominatesDestBB hasn't been computed yet, do so with EF. - if (!OtherPreds.empty()) { - while (!OtherPreds.empty() && NewBBDominatesDestBB) { - NewBBDominatesDestBB = EF->dominates(DestBB, OtherPreds.back()); - OtherPreds.pop_back(); - } - OtherPreds.clear(); - } - - // If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it - // doesn't dominate anything. - if (NewBBDominatesDestBB) - EF->setImmediateDominator(DestBB, NewBB); - } - // Should we update DominatorTree information? if (DominatorTree *DT = P->getAnalysisToUpdate()) { DomTreeNode *TINode = DT->getNode(TIBB);