[llvm] [DWARF] Emit line 0 source locations for BB padding nops (PR #99496)

Paul T Robinson via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 09:15:06 PDT 2024


================
@@ -3668,3 +3668,19 @@ bool DwarfDebug::alwaysUseRanges(const DwarfCompileUnit &CU) const {
     return true;
   return false;
 }
+
+void DwarfDebug::beginCodeAlignment(const MachineBasicBlock &MBB) {
+  auto *SP = MBB.getParent()->getFunction().getSubprogram();
+
+  bool NoDebug =
+      !SP || SP->getUnit()->getEmissionKind() == DICompileUnit::NoDebug;
+
+  if (NoDebug)
+    return;
+
+  auto PrevLoc = Asm->OutStreamer->getContext().getCurrentDwarfLoc();
+  Asm->OutStreamer->emitDwarfLocDirective(
----------------
pogo59 wrote:

Looks like it now skips the line-0 for a block that has 1-byte alignment, but not if the block happens to be aligned. 

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


More information about the llvm-commits mailing list