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

2017-08-31 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. I now think the tactic to pursue is making sure the containing DICompositeType(s) for the method have complete descriptions, and RAUW the temporary nodes, prior to calling CloneFunction. Actually wading around in the MDNodes, Types, and Decls to accomplish that

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

2017-08-29 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. In https://reviews.llvm.org/D37038#89, @aprantl wrote: > This may have gotten lost earlier: Would it be possible to instruct > CloneFunction to not clone any temporary MDNodes via one of the flags that > are passed to the ValueMapper? I tried that. Basically,

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

2017-08-29 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. In https://reviews.llvm.org/D37038#89, @aprantl wrote: > This may have gotten lost earlier: Would it be possible to instruct > CloneFunction to not clone any temporary MDNodes via one of the flags that > are passed to the ValueMapper? I did look at that, sorry

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

2017-08-29 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment. This may have gotten lost earlier: Would it be possible to instruct CloneFunction to not clone any temporary MDNodes via one of the flags that are passed to the ValueMapper? https://reviews.llvm.org/D37038 ___

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

2017-08-28 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. Dumping the whole module, the temporary DICompositeType node for CBdVfsImpl is used both as the scope node for the DISubprogram, and also as the baseType of a DIDerivedType which is a pointer type in the type list for the subprogram. Given that the DICompositeType is

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

2017-08-28 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. In https://reviews.llvm.org/D37038#854722, @probinson wrote: > finalizeSubprogram() retrieves the variables from the subprogram and handles > them; what is it missing? For temp-md-nodes2.cpp, the assertion in mapTopLevelUniquedNode() trips on a DICompositeType for

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

2017-08-28 Thread Paul Robinson via Phabricator via cfe-commits
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

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

2017-08-28 Thread Adrian Prantl via Phabricator via cfe-commits
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

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

2017-08-25 Thread Paul Robinson via Phabricator via cfe-commits
probinson added inline comments. Comment at: lib/CodeGen/CGVTables.cpp:157 + if (DebugInfo) +DebugInfo->replaceTemporaryNodes(); + aprantl wrote: > Have you looked at what it would take to only finalize the nodes reachable > via the function? > Otherwise —

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

2017-08-22 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment. Performance-wise the change is fine because it does the same amount of work, but I would prefer someone to audit the code to make sure that we aren't uniquing a node while we still want to make changes to it. Unfortunately testcases for these issues will involve

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

2017-08-22 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment. I mentioned this in the PR but I should have restated it here, sorry... Wolfgang authored this patch. He is away for a month so I volunteered to post this, in case it was okay for resolving the PR as the crash is present in the 5.0 branch. I do know Wolfgang was not

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

2017-08-22 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: lib/CodeGen/CGVTables.cpp:157 + if (DebugInfo) +DebugInfo->replaceTemporaryNodes(); + Have you looked at what it would take to only finalize the nodes reachable via the function? Otherwise — have you audited that

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

2017-08-22 Thread Paul Robinson via Phabricator via cfe-commits
probinson created this revision. Make sure all temporary MD nodes have been replaced with uniqued or distinct nodes before we clone a function. Fixes PR33930. https://reviews.llvm.org/D37038 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGVTables.cpp