[LLVMdev] How to strip all unused debugging metadata?

Renato Golin rengolin at systemcall.org
Tue Apr 24 08:55:49 PDT 2012


On 24 April 2012 16:43, Matt Pharr <matt.pharr at gmail.com> wrote:
> Perhaps the answer is that I just need to write the code that traverses the
> metadata and removes the subprogram metadata from the list of subprograms,
> if the corresponding function definition has been stripped from the module.
>  I'd have guessed that the DIBuilder infrastructure would have ended up
> doing that automagically for me, but maybe that was an incorrect assumption?

You are right in assuming that unused metadata should be cleaned when
functions/variables get removed, but whether LLVM will do that or not
is another matter.

Someone might know better (it's been 6 months last time I've looked at
debug metadata), but I don't think there's still isn't a clear way to
handle debug metadata (or any metadata for that matter), and people
end up doing locally.

DIBuilder is not the right candidate to be used by optimisations,
though. As IRBuilder, it's just a translation framework. I'm not sure
there is any. Maybe, if whomever removed the function also removed
just the subprogram tag, the rest would be removed from the output.

cheers,
--renato


-- 
cheers,
--renato

http://systemcall.org/




More information about the llvm-dev mailing list