Skip to content

Commit

Permalink
Skip the landingpad instruction when determining the insertion point.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138481 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
isanbard committed Aug 24, 2011
1 parent 327236c commit a4c86ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Analysis/ScalarEvolutionExpander.cpp
Expand Up @@ -103,7 +103,8 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, Type *Ty) {
while ((isa<BitCastInst>(IP) &&
isa<Argument>(cast<BitCastInst>(IP)->getOperand(0)) &&
cast<BitCastInst>(IP)->getOperand(0) != A) ||
isa<DbgInfoIntrinsic>(IP))
isa<DbgInfoIntrinsic>(IP) ||
isa<LandingPadInst>(IP))
++IP;
return ReuseOrCreateCast(A, Ty, Op, IP);
}
Expand All @@ -113,7 +114,9 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, Type *Ty) {
BasicBlock::iterator IP = I; ++IP;
if (InvokeInst *II = dyn_cast<InvokeInst>(I))
IP = II->getNormalDest()->begin();
while (isa<PHINode>(IP) || isa<DbgInfoIntrinsic>(IP)) ++IP;
while (isa<PHINode>(IP) || isa<DbgInfoIntrinsic>(IP) ||
isa<LandingPadInst>(IP))
++IP;
return ReuseOrCreateCast(I, Ty, Op, IP);
}

Expand Down Expand Up @@ -1109,7 +1112,8 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();
BasicBlock::iterator NewInsertPt =
llvm::next(BasicBlock::iterator(cast<Instruction>(V)));
while (isa<PHINode>(NewInsertPt) || isa<DbgInfoIntrinsic>(NewInsertPt))
while (isa<PHINode>(NewInsertPt) || isa<DbgInfoIntrinsic>(NewInsertPt) ||
isa<LandingPadInst>(NewInsertPt))
++NewInsertPt;
V = expandCodeFor(SE.getTruncateExpr(SE.getUnknown(V), Ty), 0,
NewInsertPt);
Expand Down
3 changes: 3 additions & 0 deletions lib/Transforms/Scalar/LoopStrengthReduce.cpp
Expand Up @@ -3423,6 +3423,9 @@ LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator IP,
// Don't insert instructions before PHI nodes.
while (isa<PHINode>(IP)) ++IP;

// Ignore landingpad instructions.
while (isa<LandingPadInst>(IP)) ++IP;

// Ignore debug intrinsics.
while (isa<DbgInfoIntrinsic>(IP)) ++IP;

Expand Down

0 comments on commit a4c86ab

Please sign in to comment.