[llvm] [DebugInfo] Assign best possible debugloc to bundle (PR #164573)

Vladislav Dzhidzhoev via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 22 03:27:36 PDT 2025


================
@@ -88,10 +88,17 @@ llvm::createUnpackMachineBundles(
 /// DILocation is found, then an empty location is returned.
 static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI,
                             MachineBasicBlock::instr_iterator LastMI) {
-  for (auto MII = FirstMI; MII != LastMI; ++MII)
-    if (MII->getDebugLoc())
-      return MII->getDebugLoc();
-  return DebugLoc();
+  DebugLoc DL;
+  for (auto MII = FirstMI; MII != LastMI; ++MII) {
+    DebugLoc MIIDL = MII->getDebugLoc();
+    if (MIIDL) {
+      if (MIIDL.getLine() == 0)
+        DL = MIIDL.get();
+      else
+        return MII->getDebugLoc();
----------------
dzhidzhoev wrote:

```suggestion
      if (MIIDL.getLine() != 0)
        return MIIDL;
      DL = MIIDL.get();   
```

https://github.com/llvm/llvm-project/pull/164573


More information about the llvm-commits mailing list