[PATCH] D37038: Replace temp MD nodes with unique/distinct before cloning

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 28 15:50:48 PDT 2017


probinson added a comment.

Trying to understand the broader context here, I looked back through the list of revisions mentioned in PR33930 to see if that helped.

When called on a method, CodeGenModule::EmitGlobalDefinition() calls CodeGenModule::EmitGlobalFunctionDefinition(), which in turn calls CodeGenFunction::GenerateCode(), which calls CodeGenFunction::FinishFunction(), which calls CGDebugInfo::EmitFunctionEnd(), which calls DIBuilder::finalizeSubprogram().  This is supposed to finalize the metadata for the subprogram.
If the method is virtual, EmitGlobalDefinition() then calls getVTables().EmitThunks() which eventually gets to GenerateVarArgsThunk().  Which crashes when it tries to CloneFunction the original virtual method, because an operand of some piece of metadata is still temporary.

So, either something happens such that EmitFunctionEnd() doesn't actually call finalizeSubprogram(), or finalizeSubprogram() doesn't finalize everything that it needs to finalize.

finalizeSubprogram() retrieves the variables from the subprogram and handles them; what is it missing?


https://reviews.llvm.org/D37038





More information about the cfe-commits mailing list