diff options
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 8e3ca41..0e6ab13 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1940,15 +1940,11 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { } } else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) { if (BI->isUnconditional()) { - BasicBlock::iterator BBI = BB->getFirstNonPHI(); - - // Ignore dbg intrinsics. - while (isa<DbgInfoIntrinsic>(BBI)) - ++BBI; - if (BBI->isTerminator()) // Terminator is the only non-phi instruction! - if (BB != &Fn->getEntryBlock()) - if (TryToSimplifyUncondBranchFromEmptyBlock(BB)) - return true; + // If the Terminator is the only non-phi instruction, simplify the block. + Instruction *I = BB->getFirstNonPHIOrDbg(); + if (I->isTerminator() && BB != &Fn->getEntryBlock() && + TryToSimplifyUncondBranchFromEmptyBlock(BB)) + return true; } else { // Conditional branch if (isValueEqualityComparison(BI)) { |