[PATCH] D118416: [Metadata] Use temporary MD nodes when appending module flags during module linking

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 16:12:13 PST 2022


wolfgangp created this revision.
wolfgangp added a reviewer: dexonsmith.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya.
wolfgangp requested review of this revision.
Herald added a project: LLVM.

This is a proposal to fix issue 51893 <https://github.com/llvm/llvm-project/issues/51893>.

As described there, we're seeing excessive memory usage at link time when using LTO + IPGO, and we traced it back to the appending of module flags during module linking.

This patch suggests to use temporary MD nodes for the list nodes that are newly created when module flags with SrcBehavior "append" are handled. Since we have to turn them into permanent nodes at some point, we keep track of the temp nodes in the module, and make them permanent when we know we're done with the linking.

If anyone has any better suggestions, please let me know.

@dexonsmith Apologies if you are not the right reviewer. The code has been implemented by Rafael originally, but IIRC he's no longer working on llvm.


https://reviews.llvm.org/D118416

Files:
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Module.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/tools/llvm-link/llvm-link.cpp
  llvm/unittests/Linker/LinkModulesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118416.403814.patch
Type: text/x-patch
Size: 8002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220128/463c19fa/attachment-0001.bin>


More information about the llvm-commits mailing list