[llvm-branch-commits] [llvm-branch] r99005 - in /llvm/branches/Apple/Morbo: include/llvm/Analysis/ScalarEvolutionExpander.h lib/Analysis/ScalarEvolutionExpander.cpp

Dan Gohman gohman at apple.com
Fri Mar 19 14:59:13 PDT 2010


Author: djg
Date: Fri Mar 19 16:59:12 2010
New Revision: 99005

URL: http://llvm.org/viewvc/llvm-project?rev=99005&view=rev
Log:
$ svn merge -c 99001 https://djg@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r99001 into '.':
U    include/llvm/Analysis/ScalarEvolutionExpander.h
U    lib/Analysis/ScalarEvolutionExpander.cpp

Modified:
    llvm/branches/Apple/Morbo/include/llvm/Analysis/ScalarEvolutionExpander.h
    llvm/branches/Apple/Morbo/lib/Analysis/ScalarEvolutionExpander.cpp

Modified: llvm/branches/Apple/Morbo/include/llvm/Analysis/ScalarEvolutionExpander.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=99005&r1=99004&r2=99005&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/include/llvm/Analysis/ScalarEvolutionExpander.h (original)
+++ llvm/branches/Apple/Morbo/include/llvm/Analysis/ScalarEvolutionExpander.h Fri Mar 19 16:59:12 2010
@@ -79,12 +79,7 @@
     /// expandCodeFor - Insert code to directly compute the specified SCEV
     /// expression into the program.  The inserted code is inserted into the
     /// specified block.
-    Value *expandCodeFor(const SCEV *SH, const Type *Ty, Instruction *I) {
-      BasicBlock::iterator IP = I;
-      while (isInsertedInstruction(IP)) ++IP;
-      Builder.SetInsertPoint(IP->getParent(), IP);
-      return expandCodeFor(SH, Ty);
-    }
+    Value *expandCodeFor(const SCEV *SH, const Type *Ty, Instruction *I);
 
     /// setIVIncInsertPos - Set the current IV increment loop and position.
     void setIVIncInsertPos(const Loop *L, Instruction *Pos) {

Modified: llvm/branches/Apple/Morbo/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Analysis/ScalarEvolutionExpander.cpp?rev=99005&r1=99004&r2=99005&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Analysis/ScalarEvolutionExpander.cpp Fri Mar 19 16:59:12 2010
@@ -1248,6 +1248,15 @@
   return LHS;
 }
 
+Value *SCEVExpander::expandCodeFor(const SCEV *SH, const Type *Ty,
+                                   Instruction *I) {
+  BasicBlock::iterator IP = I;
+  while (isInsertedInstruction(IP) || isa<DbgInfoIntrinsic>(IP))
+    ++IP;
+  Builder.SetInsertPoint(IP->getParent(), IP);
+  return expandCodeFor(SH, Ty);
+}
+
 Value *SCEVExpander::expandCodeFor(const SCEV *SH, const Type *Ty) {
   // Expand the code for this SCEV.
   Value *V = expand(SH);
@@ -1286,9 +1295,7 @@
       // there) so that it is guaranteed to dominate any user inside the loop.
       if (L && S->hasComputableLoopEvolution(L) && L != PostIncLoop)
         InsertPt = L->getHeader()->getFirstNonPHI();
-      while (isa<DbgInfoIntrinsic>(InsertPt))
-        InsertPt = llvm::next(BasicBlock::iterator(InsertPt));
-      while (isInsertedInstruction(InsertPt))
+      while (isInsertedInstruction(InsertPt) || isa<DbgInfoIntrinsic>(InsertPt))
         InsertPt = llvm::next(BasicBlock::iterator(InsertPt));
       break;
     }
@@ -1324,7 +1331,8 @@
   // subsequently inserted code will be dominated.
   if (Builder.GetInsertPoint() == I) {
     BasicBlock::iterator It = cast<Instruction>(I);
-    do { ++It; } while (isInsertedInstruction(It));
+    do { ++It; } while (isInsertedInstruction(It) ||
+                        isa<DbgInfoIntrinsic>(It));
     Builder.SetInsertPoint(Builder.GetInsertBlock(), It);
   }
 }
@@ -1332,7 +1340,7 @@
 void SCEVExpander::restoreInsertPoint(BasicBlock *BB, BasicBlock::iterator I) {
   // If we acquired more instructions since the old insert point was saved,
   // advance past them.
-  while (isInsertedInstruction(I)) ++I;
+  while (isInsertedInstruction(I) || isa<DbgInfoIntrinsic>(I)) ++I;
 
   Builder.SetInsertPoint(BB, I);
 }





More information about the llvm-branch-commits mailing list