diff options
Diffstat (limited to 'llvm/lib/IR/DomTreeUpdater.cpp')
-rw-r--r-- | llvm/lib/IR/DomTreeUpdater.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/llvm/lib/IR/DomTreeUpdater.cpp b/llvm/lib/IR/DomTreeUpdater.cpp index f035a86edda..b72c1b77c2c 100644 --- a/llvm/lib/IR/DomTreeUpdater.cpp +++ b/llvm/lib/IR/DomTreeUpdater.cpp @@ -152,39 +152,34 @@ bool DomTreeUpdater::forceFlushDeletedBB() { return true; } -bool DomTreeUpdater::recalculate(Function &F) { - if (!DT && !PDT) - return false; +void DomTreeUpdater::recalculate(Function &F) { if (Strategy == UpdateStrategy::Eager) { if (DT) DT->recalculate(F); if (PDT) PDT->recalculate(F); - return true; + return; } + // There is little performance gain if we pend the recalculation under + // Lazy UpdateStrategy so we recalculate available trees immediately. + // Prevent forceFlushDeletedBB() from erasing DomTree or PostDomTree nodes. IsRecalculatingDomTree = IsRecalculatingPostDomTree = true; // Because all trees are going to be up-to-date after recalculation, // flush awaiting deleted BasicBlocks. - if (forceFlushDeletedBB() || hasPendingUpdates()) { - if (DT) - DT->recalculate(F); - if (PDT) - PDT->recalculate(F); - - // Resume forceFlushDeletedBB() to erase DomTree or PostDomTree nodes. - IsRecalculatingDomTree = IsRecalculatingPostDomTree = false; - PendDTUpdateIndex = PendPDTUpdateIndex = PendUpdates.size(); - dropOutOfDateUpdates(); - return true; - } + forceFlushDeletedBB(); + if (DT) + DT->recalculate(F); + if (PDT) + PDT->recalculate(F); // Resume forceFlushDeletedBB() to erase DomTree or PostDomTree nodes. IsRecalculatingDomTree = IsRecalculatingPostDomTree = false; - return false; + PendDTUpdateIndex = PendPDTUpdateIndex = PendUpdates.size(); + dropOutOfDateUpdates(); } bool DomTreeUpdater::hasPendingUpdates() const { |