[llvm-dev] Reviving the DebugIR pass

Vedant Kumar via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 23 11:12:08 PDT 2018


> On Mar 23, 2018, at 6:47 AM, Dan Liew <dan at su-root.co.uk> wrote:
> 
>>> 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?

Yes, or the intrinsics.

> I don't think there's a simple way for Clang to know that someone has done that.

Oh, I'm not suggesting you do that. It'd be fine to just check that M.getNamedMetadata("llvm.dbg.cu") is non-null before adding any new debug info.


> 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.

Sgtm. I don't anticipate case 2 being all that uncommon, but I'll leave it up to you, as you're doing the work :).

vedant


More information about the llvm-dev mailing list