Index: lib/Transforms/Vectorize/LoopVectorize.cpp =================================================================== --- lib/Transforms/Vectorize/LoopVectorize.cpp +++ lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2568,13 +2568,15 @@ if (!Latch) Latch = Header; + DebugLoc Loc; + DL ? Loc = DL->getDebugLoc() : Loc = L->getStartLoc(); + IRBuilder<> Builder(&*Header->getFirstInsertionPt()); - Instruction *OldInst = getDebugLocFromInstOrOperands(OldInduction); - setDebugLocFromInst(Builder, OldInst); + Builder.SetCurrentDebugLocation(Loc); auto *Induction = Builder.CreatePHI(Start->getType(), 2, "index"); Builder.SetInsertPoint(Latch->getTerminator()); - setDebugLocFromInst(Builder, OldInst); + Builder.SetCurrentDebugLocation(Loc); // Create i+1 and fill the PHINode. Value *Next = Builder.CreateAdd(Induction, Step, "index.next");