]> granicus.if.org Git - llvm/commitdiff
[JumpThread] No need to erase BB from LoopHeaders. NFC.
authorJun Bum Lim <junbuml@codeaurora.org>
Wed, 1 Feb 2017 19:06:55 +0000 (19:06 +0000)
committerJun Bum Lim <junbuml@codeaurora.org>
Wed, 1 Feb 2017 19:06:55 +0000 (19:06 +0000)
Summary: No need to try to ease BB from LoopHeaders as we already know that BB is not in LoopHeaders.

Reviewers: hsung, majnemer, mcrosier, haicheng, rengolin

Reviewed By: rengolin

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29232

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293802 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/JumpThreading.cpp

index ecc6a0afbad89f03f22be143a1c11d85cc5fd849..e8e40330665dbd500965ca4a74614cc7dd72c861 100644 (file)
@@ -222,26 +222,13 @@ bool JumpThreadingPass::runImpl(Function &F, TargetLibraryInfo *TLI_,
           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.
         LVI->eraseBlock(BB);
-        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;