[PATCH] D38229: [DebugInfo] Insert DEBUG_VALUEs after each register redefinition

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 09:13:52 PDT 2017


aprantl added a comment.

In https://reviews.llvm.org/D38229#880149, @rnk wrote:

>




> One way to address this would be to avoid moving DBG_VALUEs across instructions with different DebugLoc lines.

In LiveDebugValues we use a heuristic based on the lexical scopes to avoid inserting DBG_VALUEs long after the variable went out of scope. Perhaps a similar approach is useful here, too? Otherwise, using the DebugLoc is even stricter, so that's fine with me, too.



================
Comment at: lib/CodeGen/LiveDebugVariables.cpp:1039
 
-void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
+/// findNextInsertLocation - Find an iterator for inserting the next DBG_VALUE
+/// instruction (or end if no more insert locations found).
----------------
Please remove the `findNextInsertLocation - ` we don't do/need this any more.


================
Comment at: lib/CodeGen/LiveDebugVariables.cpp:1058
+      // The insert location is directly after the instruction/bundle
+      return ++I;
+    ++I;
----------------
`return std::next(I);` ? (not sure if this is better :-)


================
Comment at: lib/CodeGen/LiveDebugVariables.cpp:1071
+  SlotIndex MBBEndIdx = LIS.getMBBEndIdx(&*MBB);
+  // Only search within the current MBB
+  StopIdx = (MBBEndIdx < StopIdx) ? MBBEndIdx : StopIdx;
----------------
`.`


https://reviews.llvm.org/D38229





More information about the llvm-commits mailing list