[PATCH] D49347: [WIP][DebugInfo][InstCombine] DebugLoc in induction PHI

Anastasis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 15 06:06:49 PDT 2018


gramanas created this revision.
gramanas added a reviewer: vsk.
Herald added subscribers: llvm-commits, JDevlieghere.

`Instruction *DL` can sometimes be nullptr at the time of the `createInductionVariable()` call.
Attach the start of the loop as DebugLoc in the induction phi and add if that's the case.


Repository:
  rL LLVM

https://reviews.llvm.org/D49347

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp


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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49347.155584.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180715/c3fce979/attachment.bin>


More information about the llvm-commits mailing list