[PATCH] D29867: [BasicBlockUtils] Use getFirstNonPHIOrDbg to set debugloc for instructions created in SplitBlockPredecessors

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 13:22:25 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295106: [BasicBlockUtils] Use getFirstNonPHIOrDbg to set debugloc for instructions… (authored by twoh).

Changed prior to commit:
  https://reviews.llvm.org/D29867?vs=88323&id=88424#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29867

Files:
  llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/trunk/test/Transforms/LoopSimplify/dbg-loc.ll


Index: llvm/trunk/test/Transforms/LoopSimplify/dbg-loc.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopSimplify/dbg-loc.ll
+++ llvm/trunk/test/Transforms/LoopSimplify/dbg-loc.ll
@@ -23,6 +23,7 @@
 
 for.body:                                         ; preds = %entry, %length.exit
   %begin.sink5 = phi %"Length"* [ %incdec.ptr, %length.exit ], [ %begin, %entry ]
+  tail call void @llvm.dbg.value(metadata %"Length"* %begin.sink5, i64 0, metadata !15, metadata !16), !dbg !17
   %m_type.i.i.i = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 0, i32 2, !dbg !9
   %0 = load i8, i8* %m_type.i.i.i, align 1, !dbg !9
   %cmp.i.i = icmp eq i8 %0, 9, !dbg !7
@@ -68,6 +69,9 @@
   resume { i8*, i32 } undef, !dbg !13
 }
 
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
+
 ; CHECK-DAG: [[PREHEADER_LOC]] = !DILocation(line: 73, column: 27, scope: !{{[0-9]+}})
 ; CHECK-DAG: [[LOOPEXIT_LOC]] = !DILocation(line: 75, column: 9, scope: !{{[0-9]+}})
 ; CHECK-DAG: [[LPAD_PREHEADER_LOC]] = !DILocation(line: 85, column: 1, scope: !{{[0-9]+}})
@@ -93,3 +97,6 @@
                              file: !5,
                              isOptimized: true, flags: "-O2",
                              splitDebugFilename: "abc.debug", emissionKind: 2)
+!15 = !DILocalVariable(name: "begin", arg: 1, scope: !6, file: !5, line: 71)
+!16 = !DIExpression()
+!17 = !DILocation(line: 71, column: 32, scope: !6)
Index: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -438,7 +438,7 @@
 
   // The new block unconditionally branches to the old block.
   BranchInst *BI = BranchInst::Create(BB, NewBB);
-  BI->setDebugLoc(BB->getFirstNonPHI()->getDebugLoc());
+  BI->setDebugLoc(BB->getFirstNonPHIOrDbg()->getDebugLoc());
 
   // Move the edges from Preds to point to NewBB instead of BB.
   for (unsigned i = 0, e = Preds.size(); i != e; ++i) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29867.88424.patch
Type: text/x-patch
Size: 2131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170214/0f0ef716/attachment.bin>


More information about the llvm-commits mailing list