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

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 02:35:31 PDT 2025


================
@@ -88,10 +88,16 @@ 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) {
----------------
OCHyams wrote:

```suggestion
    if (DebugLoc MIIDL = MII->getDebugLoc()) {
```

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


More information about the llvm-commits mailing list