[llvm] r293802 - [JumpThread] No need to erase BB from LoopHeaders. NFC.

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 11:06:55 PST 2017


Author: junbuml
Date: Wed Feb  1 13:06:55 2017
New Revision: 293802

URL: http://llvm.org/viewvc/llvm-project?rev=293802&view=rev
Log:
[JumpThread] No need to erase BB from LoopHeaders. NFC.

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

Modified:
    llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=293802&r1=293801&r2=293802&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Wed Feb  1 13:06:55 2017
@@ -222,26 +222,13 @@ bool JumpThreadingPass::runImpl(Function
           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;




More information about the llvm-commits mailing list