[PATCH] D147506: [DebugLine] save one debug line entry for empty prologue

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 14:19:54 PDT 2023


dblaikie added a comment.

> Due to this, handling the zero-length skipping in the higher level, when recordSourceLine() is called for each instruction and prologue, seems be consistent for all cases. So DwarfDebug::beginInstruction() seems like a right place.

Could we do it down in recordSourceLine? Somewhere it can be done once and handle both the `beginInstruction` and `emitInitialLocDirective` cases in a single place, so there's a better chance that these things don't get out of sync, or a 3rd place doesn't cause the same problem later on.

(Ideally, maybe, even lower in the MCStreamer - but above either the MCAsm or MCObjectStreamer (so there'd be some non-virtual MCStreamer function that keeps track of this/skips the duplicate entry, then delegates to MCAsmStreamer/MCOBjectStreamer) - though not sure there's a convenient way to track whether the entry is zero-length or not there)

Like maybe `recordSourceLine` raises a flag and `beginInstruction` checks the flag, and if the flag is raised, it calls `Asm.OutStreamer->emitDwarfLocDirective` and lowers the flag. Then any redundant line directives aren't emitted, they are just overwritten.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147506/new/

https://reviews.llvm.org/D147506



More information about the llvm-commits mailing list