diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-12-06 13:21:01 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-12-06 13:21:01 +0000 |
commit | cb5331eb932c1367e8396378eaa976f38d5f3688 (patch) | |
tree | db9a68bee645fbc1daea8a5624bc7b39ac607eee /llvm/lib/Transforms | |
parent | 8ba5ee57a011a56e554b2fa393feefb4012ac928 (diff) | |
download | bcm5719-llvm-cb5331eb932c1367e8396378eaa976f38d5f3688.tar.gz bcm5719-llvm-cb5331eb932c1367e8396378eaa976f38d5f3688.zip |
Revert "[LoopSimplifyCFG] Delete dead in-loop blocks"
This reverts commit r348457.
The original commit causes clang to crash when doing an instrumented
build with a new pass manager. Reverting to unbreak our integrate.
llvm-svn: 348484
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp index 9d5b33e6343..3de701e7887 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -46,8 +46,6 @@ static cl::opt<bool> EnableTermFolding("enable-loop-simplifycfg-term-folding", STATISTIC(NumTerminatorsFolded, "Number of terminators folded to unconditional branches"); -STATISTIC(NumLoopBlocksDeleted, - "Number of loop blocks deleted"); /// If \p BB is a switch or a conditional branch, but only one of its successors /// can be reached from this block in runtime, return this successor. Otherwise, @@ -236,27 +234,6 @@ private: "All blocks that stay in loop should be live!"); } - /// Delete loop blocks that have become unreachable after folding. Make all - /// relevant updates to DT and LI. - void deleteDeadLoopBlocks() { - DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); - if (MSSAU) - MSSAU->removeBlocks(DeadLoopBlocks); - for (auto *BB : DeadLoopBlocks) { - assert(BB != L.getHeader() && - "Header of the current loop cannot be dead!"); - LLVM_DEBUG(dbgs() << "Deleting dead loop block " << BB->getName() - << "\n"); - if (LI.isLoopHeader(BB)) { - assert(LI.getLoopFor(BB) != &L && "Attempt to remove current loop!"); - LI.erase(LI.getLoopFor(BB)); - } - LI.removeBlock(BB); - DeleteDeadBlock(BB, &DTU); - ++NumLoopBlocksDeleted; - } - } - /// Constant-fold terminators of blocks acculumated in FoldCandidates into the /// unconditional branches. void foldTerminators() { @@ -341,6 +318,15 @@ public: return false; } + // TODO: Support deletion of dead loop blocks. + if (!DeadLoopBlocks.empty()) { + LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop " + << L.getHeader()->getName() + << ": we don't currently" + " support deletion of dead in-loop blocks.\n"); + return false; + } + // TODO: Support dead loop exits. if (!DeadExitBlocks.empty()) { LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop " @@ -351,8 +337,7 @@ public: // TODO: Support blocks that are not dead, but also not in loop after the // folding. - if (BlocksInLoopAfterFolding.size() + DeadLoopBlocks.size() != - L.getNumBlocks()) { + if (BlocksInLoopAfterFolding.size() != L.getNumBlocks()) { LLVM_DEBUG( dbgs() << "Give up constant terminator folding in loop " << L.getHeader()->getName() @@ -372,13 +357,6 @@ public: // Make the actual transforms. foldTerminators(); - if (!DeadLoopBlocks.empty()) { - LLVM_DEBUG(dbgs() << "Deleting " << DeadLoopBlocks.size() - << " dead blocks in loop " << L.getHeader()->getName() - << "\n"); - deleteDeadLoopBlocks(); - } - #ifndef NDEBUG // Make sure that we have preserved all data structures after the transform. DT.verify(); |