|
44 | 44 | #include "llvm/Analysis/AliasSetTracker.h" |
45 | 45 | #include "llvm/Analysis/AssumptionCache.h" |
46 | 46 | #include "llvm/Analysis/CaptureTracking.h" |
| 47 | +#include "llvm/Analysis/DomTreeUpdater.h" |
47 | 48 | #include "llvm/Analysis/GuardUtils.h" |
48 | 49 | #include "llvm/Analysis/LazyBlockFrequencyInfo.h" |
49 | 50 | #include "llvm/Analysis/Loads.h" |
|
65 | 66 | #include "llvm/IR/DebugInfoMetadata.h" |
66 | 67 | #include "llvm/IR/DerivedTypes.h" |
67 | 68 | #include "llvm/IR/Dominators.h" |
| 69 | +#include "llvm/IR/IRBuilder.h" |
68 | 70 | #include "llvm/IR/Instructions.h" |
69 | 71 | #include "llvm/IR/IntrinsicInst.h" |
70 | | -#include "llvm/IR/IRBuilder.h" |
71 | 72 | #include "llvm/IR/LLVMContext.h" |
72 | 73 | #include "llvm/IR/Metadata.h" |
73 | 74 | #include "llvm/IR/PatternMatch.h" |
@@ -567,12 +568,11 @@ bool llvm::sinkRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI, |
567 | 568 | // We want to visit children before parents. We will enqueue all the parents |
568 | 569 | // before their children in the worklist and process the worklist in reverse |
569 | 570 | // order. |
570 | | - SmallVector<DomTreeNode *, 16> Worklist = collectChildrenInLoop(N, CurLoop); |
| 571 | + SmallVector<BasicBlock *, 16> Worklist = |
| 572 | + collectChildrenInLoop(DT, N, CurLoop); |
571 | 573 |
|
572 | 574 | bool Changed = false; |
573 | | - for (DomTreeNode *DTN : reverse(Worklist)) { |
574 | | - BasicBlock *BB = DTN->getBlock(); |
575 | | - // Only need to process the contents of this block if it is not part of a |
| 575 | + for (BasicBlock *BB : reverse(Worklist)) { |
576 | 576 | // subloop (which would already have been processed). |
577 | 577 | if (inSubLoop(BB, CurLoop, LI)) |
578 | 578 | continue; |
@@ -1603,13 +1603,14 @@ static void splitPredecessorsOfLoopExit(PHINode *PN, DominatorTree *DT, |
1603 | 1603 | // |
1604 | 1604 | const auto &BlockColors = SafetyInfo->getBlockColors(); |
1605 | 1605 | SmallSetVector<BasicBlock *, 8> PredBBs(pred_begin(ExitBB), pred_end(ExitBB)); |
| 1606 | + DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy); |
1606 | 1607 | while (!PredBBs.empty()) { |
1607 | 1608 | BasicBlock *PredBB = *PredBBs.begin(); |
1608 | 1609 | assert(CurLoop->contains(PredBB) && |
1609 | 1610 | "Expect all predecessors are in the loop"); |
1610 | 1611 | if (PN->getBasicBlockIndex(PredBB) >= 0) { |
1611 | 1612 | BasicBlock *NewPred = SplitBlockPredecessors( |
1612 | | - ExitBB, PredBB, ".split.loop.exit", DT, LI, MSSAU, true); |
| 1613 | + ExitBB, PredBB, ".split.loop.exit", &DTU, LI, MSSAU, true); |
1613 | 1614 | // Since we do not allow splitting EH-block with BlockColors in |
1614 | 1615 | // canSplitPredecessors(), we can simply assign predecessor's color to |
1615 | 1616 | // the new block. |
|
0 commit comments