From 6aae1d6582fe8519c42d9774d670bb93c78e9637 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 26 Mar 2009 01:15:07 +0000 Subject: [PATCH] Skip debug info one more place. (This one gets called from llc, not opt, but it's an IR level optimization nevertheless.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67724 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/CodeGenPrepare.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 85e57661c15..b0214e030da 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/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(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(I)) + I++; + if (dyn_cast(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; -- 2.34.1