[llvm-dev] Function to strip Module of all debug information

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 24 21:43:45 PDT 2017


> On Mar 19, 2017, at 8:41 AM, SANJAY SRIVALLABH SINGAPURAM via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> I need to strip a Module of all debug information before sending it to verifyModule

It is not clear to me why?

> (This is a Module meant for NVPTX code). I've been using llvm::StripDebugInfo, but it doesn't strip some of the debug information. Following is an output from Verifier::visitInstruction,
> 
> Cannot invoke an intrinsic other than donothing, patchpoint, statepoint, coro_resume or coro_destroy
>   store void (metadata, i64, metadata, metadata)* @llvm.dbg.value, void (metadata, i64, metadata, metadata)** %polly_launch_0_param_7, align 8

This is not a debug info, this is a buggy IR!


> 
> Will the following change to lib/IR/DebugInfo.cpp help resolve the problem ?

It would resolve your problem, but this is not a correct solution I believe. So we should rather understand where this store comes from and fix the code that creates it.

— 
Mehdi



> @@ -312,7 +312,7 @@ bool llvm::StripDebugInfo(Module &M) {
>  
>      // We're stripping debug info, and without them, coverage information
>      // doesn't quite make sense.
> -    if (NMD->getName().startswith("llvm.dbg.") ||
> +    if (NMD->getName().contains("llvm.dbg.") ||
>          NMD->getName() == "llvm.gcov") {
>        NMD->eraseFromParent();
>        Changed = true
> 
> I'm not sure if NamedMDNodes are going to include instructions.
> 
> Although llvm::stripDebugInfo(Function &F) (called through StripDebugInfo on Functions present in the Module) removes DbgInfoIntrinsic instructions, it seems to miss this store instruction. Does this store to a @llvm.dbg.value count as a DbgInfoIntrinsic instruction ?
> 
> Please suggest a function to strip even this instruction.
> 
> Also, what does storing something at a place pointed by a function pointer mean in the context of a debug intrinsic ?
> 
> Thank You,
> Sanjay
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170324/5c4140f8/attachment.html>


More information about the llvm-dev mailing list