[PATCH] D157158: Do not merge debug locations when sinking instructions

Daniel Paoliello via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 16:38:32 PDT 2023


dpaoliello created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
dpaoliello requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The `MachineSink` pass moves instructions, it doesn't merge them, therefore it doesn't make sense for it to merge debug locations as leaving them intact will still produce accurate debug information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157158

Files:
  llvm/lib/CodeGen/MachineSink.cpp


Index: llvm/lib/CodeGen/MachineSink.cpp
===================================================================
--- llvm/lib/CodeGen/MachineSink.cpp
+++ llvm/lib/CodeGen/MachineSink.cpp
@@ -1090,15 +1090,6 @@
 static void performSink(MachineInstr &MI, MachineBasicBlock &SuccToSinkTo,
                         MachineBasicBlock::iterator InsertPos,
                         ArrayRef<MIRegs> DbgValuesToSink) {
-  // If we cannot find a location to use (merge with), then we erase the debug
-  // location to prevent debug-info driven tools from potentially reporting
-  // wrong location information.
-  if (!SuccToSinkTo.empty() && InsertPos != SuccToSinkTo.end())
-    MI.setDebugLoc(DILocation::getMergedLocation(MI.getDebugLoc(),
-                                                 InsertPos->getDebugLoc()));
-  else
-    MI.setDebugLoc(DebugLoc());
-
   // Move the instruction.
   MachineBasicBlock *ParentBlock = MI.getParent();
   SuccToSinkTo.splice(InsertPos, ParentBlock, MI,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157158.547401.patch
Type: text/x-patch
Size: 982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230804/6163055b/attachment.bin>


More information about the llvm-commits mailing list