[llvm-commits] [llvm] r121664 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 12 17:28:06 PST 2010
Author: lattner
Date: Sun Dec 12 19:28:06 2010
New Revision: 121664
URL: http://llvm.org/viewvc/llvm-project?rev=121664&view=rev
Log:
use getFirstNonPHIOrDbg to simplify this code.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=121664&r1=121663&r2=121664&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun Dec 12 19:28:06 2010
@@ -1940,15 +1940,11 @@
}
} 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)) {
More information about the llvm-commits
mailing list