summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-23 21:05:58 +0000
committerDan Gohman <gohman@apple.com>2008-05-23 21:05:58 +0000
commitf96e1371e85a5b6be0d787f56e5882e7b63eefc7 (patch)
treedb75aafa57099ddbeac35a41a9b9250a1b89fb2e /llvm/lib/Transforms/Scalar/TailDuplication.cpp
parentc11802a521b48dc3626fcaac3ff73f5847acd33e (diff)
downloadbcm5719-llvm-f96e1371e85a5b6be0d787f56e5882e7b63eefc7.tar.gz
bcm5719-llvm-f96e1371e85a5b6be0d787f56e5882e7b63eefc7.zip
Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality. llvm-svn: 51499
Diffstat (limited to 'llvm/lib/Transforms/Scalar/TailDuplication.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/TailDuplication.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
index 3fd09f107cd..d0998ab5a65 100644
--- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
@@ -118,8 +118,7 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI,
++PI;
if (PI == PE) return false; // Exactly one predecessor!
- BasicBlock::iterator I = Dest->begin();
- while (isa<PHINode>(*I)) ++I;
+ BasicBlock::iterator I = Dest->getFirstNonPHI();
for (unsigned Size = 0; I != Dest->end(); ++I) {
if (Size == Threshold) return false; // The block is too large.
@@ -254,8 +253,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
// If there are non-phi instructions in DestBlock that have no operands
// defined in DestBlock, and if the instruction has no side effects, we can
// move the instruction to DomBlock instead of duplicating it.
- BasicBlock::iterator BBI = DestBlock->begin();
- while (isa<PHINode>(BBI)) ++BBI;
+ BasicBlock::iterator BBI = DestBlock->getFirstNonPHI();
while (!isa<TerminatorInst>(BBI)) {
Instruction *I = BBI++;
OpenPOWER on IntegriCloud