use getFirstNonPHIOrDbg to simplify this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121664 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-12-13 01:28:06 +00:00
parent d5b4db9824
commit dcb54ce3da

View File

@ -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)) {