[llvm-commits] [llvm] r137679 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Bill Wendling
isanbard at gmail.com
Mon Aug 15 16:19:54 PDT 2011
Author: void
Date: Mon Aug 15 18:19:54 2011
New Revision: 137679
URL: http://llvm.org/viewvc/llvm-project?rev=137679&view=rev
Log:
In places where it's using "getFirstNonPHI", skip the landingpad instruction if necessary.
Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=137679&r1=137678&r2=137679&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Aug 15 18:19:54 2011
@@ -469,7 +469,7 @@
if (!InsertedCmp) {
BasicBlock::iterator InsertPt = UserBB->getFirstNonPHI();
-
+ if (isa<LandingPadInst>(InsertPt)) ++InsertPt; // Skip landingpad inst.
InsertedCmp =
CmpInst::Create(CI->getOpcode(),
CI->getPredicate(), CI->getOperand(0),
@@ -561,10 +561,13 @@
(DVI->getParent() != VI->getParent() || DT->dominates(DVI, VI))) {
DEBUG(dbgs() << "Moving Debug Value before :\n" << *DVI << ' ' << *VI);
DVI->removeFromParent();
- if (isa<PHINode>(VI))
- DVI->insertBefore(VI->getParent()->getFirstNonPHI());
- else
+ if (isa<PHINode>(VI)) {
+ BasicBlock::iterator InsertPt = VI->getParent()->getFirstNonPHI();
+ if (isa<LandingPadInst>(InsertPt)) ++InsertPt;
+ DVI->insertBefore(InsertPt);
+ } else {
DVI->insertAfter(VI);
+ }
return true;
}
@@ -1061,7 +1064,7 @@
if (!InsertedTrunc) {
BasicBlock::iterator InsertPt = UserBB->getFirstNonPHI();
-
+ if (isa<LandingPadInst>(InsertPt)) ++InsertPt;
InsertedTrunc = new TruncInst(I, Src->getType(), "", InsertPt);
}
More information about the llvm-commits
mailing list