[llvm-dev] Reviving the DebugIR pass

Dan Liew via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 23 06:47:45 PDT 2018


>> This work could also be used to fix [3]. Although this probably needs
>> more though because there's the question of whether we should preserve
>> existing debug information in an LLVM IR file or write over it when it
>> is given to Clang.
>
>
> If foo.ll contains edited debug info, `clang -g` shouldn't silently drop the
> edits. A warning + no-op seems more appropriate.

By "edited" I assume you mean someone manually going in and changing
the debug info metadata?
I don't think there's a simple way for Clang to know that someone has done that.

I imagined that the most appropriate behaviour for `clang -g foo.ll`
(also `llvm-as -g`) would be something like.

* If `foo.ll` already contains debug information so leave it alone
(i.e. use what is already there)
* If `foo.ll` does **not** contain debug information use `foo.ll` for
debug locations. Possibly also emit a warning when this happens
because this is not a common case.


More information about the llvm-dev mailing list