]> granicus.if.org Git - llvm/commitdiff
Reset debug loc to OldInduction in InnerLoopVectorizer::createInductionVariable....
authorDehao Chen <dehao@google.com>
Mon, 7 Nov 2016 21:59:40 +0000 (21:59 +0000)
committerDehao Chen <dehao@google.com>
Mon, 7 Nov 2016 21:59:40 +0000 (21:59 +0000)
This is to prevent SetInsertionPoint from setting debug loc to Latch->getTerminator().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286159 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index e3d4be73970c8f5f8c6a032d02e913f18b1700e7..2c43a5679e47f2416859224624305dfd58ebba1d 100644 (file)
@@ -3040,10 +3040,12 @@ PHINode *InnerLoopVectorizer::createInductionVariable(Loop *L, Value *Start,
     Latch = Header;
 
   IRBuilder<> Builder(&*Header->getFirstInsertionPt());
-  setDebugLocFromInst(Builder, getDebugLocFromInstOrOperands(OldInduction));
+  Instruction *OldInst = getDebugLocFromInstOrOperands(OldInduction);
+  setDebugLocFromInst(Builder, OldInst);
   auto *Induction = Builder.CreatePHI(Start->getType(), 2, "index");
 
   Builder.SetInsertPoint(Latch->getTerminator());
+  setDebugLocFromInst(Builder, OldInst);
 
   // Create i+1 and fill the PHINode.
   Value *Next = Builder.CreateAdd(Induction, Step, "index.next");