[PATCH] D51908: [DebugInfo] Do not generate address info for removed labels.

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 10:40:43 PDT 2018


probinson added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:871
+    if (Sym)
+      addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym);
   }
----------------
Fold the if and getSymbol together:
```
if (Label)
  if (const MCSymbol *Sym = Label->getSymbol())
    addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym);
```
You could maybe use `auto *` as well, instead of spelling out the type.


================
Comment at: test/DebugInfo/Generic/debug-label-unreached.ll:8
+; CHECK-NEXT: DW_AT_name {{.*}}"done"
+; CHECK: DW_AT_low_pc
+; CHECK: DW_TAG_label
----------------
Make sure the low_pc is part of the same tag by putting this in front of it:
`; CHECK-NOT: {{DW_TAG|NULL}}`



Repository:
  rL LLVM

https://reviews.llvm.org/D51908





More information about the llvm-commits mailing list