[PATCH] D29232: [JumpThread] No need to erase BB from LoopHeaders. NFC.

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 11:18:17 PST 2017

This revision was automatically updated to reflect the committed changes.
Closed by commit rL293802: [JumpThread] No need to erase BB from LoopHeaders. NFC. (authored by junbuml).

Changed prior to commit:




Index: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
@@ -222,26 +222,13 @@
           BB != &BB->getParent()->getEntryBlock() &&
           // If the terminator is the only non-phi instruction, try to nuke it.
           BB->getFirstNonPHIOrDbg()->isTerminator() && !LoopHeaders.count(BB)) {
-        // Since TryToSimplifyUncondBranchFromEmptyBlock may delete the
-        // block, we have to make sure it isn't in the LoopHeaders set.  We
-        // reinsert afterward if needed.
-        bool ErasedFromLoopHeaders = LoopHeaders.erase(BB);
-        BasicBlock *Succ = BI->getSuccessor(0);
         // FIXME: It is always conservatively correct to drop the info
         // for a block even if it doesn't get erased.  This isn't totally
         // awesome, but it allows us to use AssertingVH to prevent nasty
         // dangling pointer issues within LazyValueInfo.
-        if (TryToSimplifyUncondBranchFromEmptyBlock(BB)) {
+        if (TryToSimplifyUncondBranchFromEmptyBlock(BB))
           Changed = true;
-          // If we deleted BB and BB was the header of a loop, then the
-          // successor is now the header of the loop.
-          BB = Succ;
-        }
-        if (ErasedFromLoopHeaders)
-          LoopHeaders.insert(BB);
     EverChanged |= Changed;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29232.86682.patch
Type: text/x-patch
Size: 1512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170201/e94dc13f/attachment.bin>

More information about the llvm-commits mailing list