mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-19 16:35:10 +00:00
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:
parent
d5b4db9824
commit
dcb54ce3da
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user