diff options
| author | Chijun Sima <simachijun@gmail.com> | 2019-02-22 05:41:43 +0000 |
|---|---|---|
| committer | Chijun Sima <simachijun@gmail.com> | 2019-02-22 05:41:43 +0000 |
| commit | f131d6110eb1a981fd65e630051abe57ab6a4fa9 (patch) | |
| tree | 02353cc2162bf583a4bba9d47bab381ffd19968e /llvm/lib/Transforms/Utils | |
| parent | 00ebc0cb92e94b654cc0cf0dc67dde8e440699bd (diff) | |
| download | bcm5719-llvm-f131d6110eb1a981fd65e630051abe57ab6a4fa9.tar.gz bcm5719-llvm-f131d6110eb1a981fd65e630051abe57ab6a4fa9.zip | |
[DTU] Deprecate insertEdge*/deleteEdge*
Summary: This patch converts all existing `insertEdge*/deleteEdge*` to `applyUpdates` and marks `insertEdge*/deleteEdge*` as deprecated.
Reviewers: kuhar, brzycki
Reviewed By: kuhar, brzycki
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58443
llvm-svn: 354652
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 18 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 7 |
3 files changed, 16 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 6f49eaec428..0d6d1022502 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -721,7 +721,7 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB, UncondBranch->eraseFromParent(); if (DTU) - DTU->deleteEdge(Pred, BB); + DTU->applyUpdates({{DominatorTree::Delete, Pred, BB}}); return cast<ReturnInst>(NewRet); } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 12c4ff1e37c..3ef549429b3 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -128,7 +128,8 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions, Builder.CreateBr(Destination); BI->eraseFromParent(); if (DTU) - DTU->deleteEdgeRelaxed(BB, OldDest); + DTU->applyUpdates({{DominatorTree::Delete, BB, OldDest}}, + /*ForceRemoveDuplicates*/ true); return true; } @@ -204,7 +205,8 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions, i = SI->removeCase(i); e = SI->case_end(); if (DTU) - DTU->deleteEdgeRelaxed(ParentBB, DefaultDest); + DTU->applyUpdates({{DominatorTree::Delete, ParentBB, DefaultDest}}, + /*ForceRemoveDuplicates*/ true); continue; } @@ -664,7 +666,8 @@ void llvm::RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred, if (PhiIt != OldPhiIt) PhiIt = &BB->front(); } if (DTU) - DTU->deleteEdgeRelaxed(Pred, BB); + DTU->applyUpdates({{DominatorTree::Delete, Pred, BB}}, + /*ForceRemoveDuplicates*/ true); } /// MergeBasicBlockIntoOnlyPred - DestBB is a block with one predecessor and its @@ -1967,7 +1970,8 @@ static void changeToCall(InvokeInst *II, DomTreeUpdater *DTU = nullptr) { UnwindDestBB->removePredecessor(BB); II->eraseFromParent(); if (DTU) - DTU->deleteEdgeRelaxed(BB, UnwindDestBB); + DTU->applyUpdates({{DominatorTree::Delete, BB, UnwindDestBB}}, + /*ForceRemoveDuplicates*/ true); } BasicBlock *llvm::changeToInvokeAndSplitBasicBlock(CallInst *CI, @@ -2114,7 +2118,8 @@ static bool markAliveBlocks(Function &F, UnwindDestBB->removePredecessor(II->getParent()); II->eraseFromParent(); if (DTU) - DTU->deleteEdgeRelaxed(BB, UnwindDestBB); + DTU->applyUpdates({{DominatorTree::Delete, BB, UnwindDestBB}}, + /*ForceRemoveDuplicates*/ true); } else changeToCall(II, DTU); Changed = true; @@ -2203,7 +2208,8 @@ void llvm::removeUnwindEdge(BasicBlock *BB, DomTreeUpdater *DTU) { TI->replaceAllUsesWith(NewTI); TI->eraseFromParent(); if (DTU) - DTU->deleteEdgeRelaxed(BB, UnwindDest); + DTU->applyUpdates({{DominatorTree::Delete, BB, UnwindDest}}, + /*ForceRemoveDuplicates*/ true); } /// removeUnreachableBlocks - Remove blocks that are not reachable, even diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 44f47bf71ca..c3a02685244 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -535,10 +535,9 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT = nullptr, DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); if (DT) { // Update the dominator tree by informing it about the new edge from the - // preheader to the exit. - DTU.insertEdge(Preheader, ExitBlock); - // Inform the dominator tree about the removed edge. - DTU.deleteEdge(Preheader, L->getHeader()); + // preheader to the exit and the removed edge. + DTU.applyUpdates({{DominatorTree::Insert, Preheader, ExitBlock}, + {DominatorTree::Delete, Preheader, L->getHeader()}}); } // Use a map to unique and a vector to guarantee deterministic ordering. |

