diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-13 01:28:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-13 01:28:06 +0000 |
commit | dcb54ce3da15ba41adeee020288e6c62cfae8c42 (patch) | |
tree | be4cf4f30bf004bd2ec2aee6b4868be2c2e61e05 | |
parent | d5b4db982478e349a8c8759da182636b888b875f (diff) | |
download | external_llvm-dcb54ce3da15ba41adeee020288e6c62cfae8c42.zip external_llvm-dcb54ce3da15ba41adeee020288e6c62cfae8c42.tar.gz external_llvm-dcb54ce3da15ba41adeee020288e6c62cfae8c42.tar.bz2 |
use getFirstNonPHIOrDbg to simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121664 91177308-0d34-0410-b5e6-96231b3b80d8
-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)) { |