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

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 28 11:48:08 PDT 2017

aprantl added inline comments.

Comment at: lib/CodeGen/CGVTables.cpp:157
+  if (DebugInfo)
+    DebugInfo->replaceTemporaryNodes();
probinson wrote:
> aprantl wrote:
> > Have you looked at what it would take to only finalize the nodes reachable via the function?
> > Otherwise — have you audited that this is always safe?
> I do not know how to find nodes reachable from a particular function, either before or after they are finalized.
> GenerateVarArgsThunk is called after we do EmitGlobalFunctionDefinition on the function we are about to clone.  The ReplaceMap holds replaceable forward type declarations, I think?  So I can imagine that codegen for a subsequent function might need to create a complete type, even one that is reachable from the function we are about to clone.
> Of course I find the whole metadata memory management scheme pretty opaque, but this is my best guess about the situation.
Alternatively, would it be possible to instruct CloneFunction to not clone any temporary MDNodes via one of the flags that are passed to ValueMapper?


More information about the cfe-commits mailing list