summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-26 01:15:07 +0000
committerDale Johannesen <dalej@apple.com>2009-03-26 01:15:07 +0000
commitdb90560c1c5314972c1d42fbb86e734cc4a2fd1c (patch)
tree2b166bfa54d1238d6e3a4c7aa4248900d96e8505 /llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
parentdfbbdf6fd535ea9ace3d8b795d2b324e8330f320 (diff)
downloadbcm5719-llvm-db90560c1c5314972c1d42fbb86e734cc4a2fd1c.tar.gz
bcm5719-llvm-db90560c1c5314972c1d42fbb86e734cc4a2fd1c.zip
Skip debug info one more place. (This one gets
called from llc, not opt, but it's an IR level optimization nevertheless.) llvm-svn: 67724
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 85e57661c15..b0214e030da 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -20,6 +20,7 @@
#include "llvm/Function.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
#include "llvm/Pass.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
@@ -350,15 +351,20 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum,
BasicBlock *Pred = *PI;
// To be usable, the pred has to end with an uncond branch to the dest.
BranchInst *PredBr = dyn_cast<BranchInst>(Pred->getTerminator());
- if (!PredBr || !PredBr->isUnconditional() ||
- // Must be empty other than the branch.
- &Pred->front() != PredBr ||
- // Cannot be the entry block; its label does not get emitted.
- Pred == &(Dest->getParent()->getEntryBlock()))
+ if (!PredBr || !PredBr->isUnconditional())
+ continue;
+ // Must be empty other than the branch and debug info.
+ BasicBlock::iterator I = Pred->begin();
+ while (isa<DbgInfoIntrinsic>(I))
+ I++;
+ if (dyn_cast<Instruction>(I) != PredBr)
+ continue;
+ // Cannot be the entry block; its label does not get emitted.
+ if (Pred == &(Dest->getParent()->getEntryBlock()))
continue;
// Finally, since we know that Dest has phi nodes in it, we have to make
- // sure that jumping to Pred will have the same affect as going to Dest in
+ // sure that jumping to Pred will have the same effect as going to Dest in
// terms of PHI values.
PHINode *PN;
unsigned PHINo = 0;
OpenPOWER on IntegriCloud