[LLVMdev] How to strip all unused debugging metadata?

Matt Pharr matt.pharr at gmail.com
Tue Apr 24 08:04:25 PDT 2012


When I generate debug information for a source file that has a number of static functions that are unused, all of the debugging metadata that I generated for them during initial compilation remains even after the source function definitions have been stripped out of the IR.  (e.g. in the MD for DW_TAG_compile_unit's list of subprograms, each of those functions' info is still in the list, and so forth).  How can I remove that unused stuff?  (It continues on to generated object files, which is extra undesirable when there is a lot of this.)

I would have expected that the strip-dead-debug-info pass would take care of this, but it doesn't make a difference--looking at its implementation, it just iterates over llvm.dbg.gv and llvm.dbg.sp and removes entries from there that are unused.  In my case, DIBuilder doesn't seem to be declaring llvm.dbg.sp in the first place--is the a symptom of a problem? 

Thanks,
-matt





More information about the llvm-dev mailing list