From 08f55d02da2cd24f3b4297259ef6429b8bf1ef97 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Wed, 16 Jun 2010 21:13:38 +0000 Subject: [PATCH] A few more places where SCEVExpander bits need to skip over debug intrinsics when iterating through instructions. Yet more work for rdar://7797940 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106149 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScalarEvolutionExpander.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 4f49bf17fb4..b4b00b9500a 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -97,7 +97,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, const Type *Ty) { BasicBlock::iterator It = I; ++It; if (isa(I)) It = cast(I)->getNormalDest()->begin(); - while (isa(It)) ++It; + while (isa(It) || isa(It)) ++It; if (It != BasicBlock::iterator(CI)) { // Recreate the cast after the user. // The old cast is left in place in case it is being used @@ -115,7 +115,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, const Type *Ty) { BasicBlock::iterator IP = I; ++IP; if (InvokeInst *II = dyn_cast(I)) IP = II->getNormalDest()->begin(); - while (isa(IP)) ++IP; + while (isa(IP) || isa(IP)) ++IP; Instruction *CI = CastInst::Create(Op, V, Ty, V->getName(), IP); rememberInstruction(CI); return CI; @@ -1070,7 +1070,8 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint(); BasicBlock::iterator NewInsertPt = llvm::next(BasicBlock::iterator(cast(V))); - while (isa(NewInsertPt)) ++NewInsertPt; + while (isa(NewInsertPt) || isa(NewInsertPt)) + ++NewInsertPt; V = expandCodeFor(SE.getTruncateExpr(SE.getUnknown(V), Ty), 0, NewInsertPt); restoreInsertPoint(SaveInsertBB, SaveInsertPt);