[llvm-dev] [ThinLTO] Using two different IRMovers for the same composite module? (related to PR28180)

Taewook Oh via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 22 13:50:49 PDT 2016


Hello,

While trying ThinLTO, I ran into an assertion failure in IRMover:  https://llvm.org/bugs/show_bug.cgi?id=28180. I found that the assertion failure is happening because IRMover tries to map the metadata that already mapped in the destination module, and it seems that this happens because two different IRMovers are used for the same destination (or composite) module. During LTO, an IRMover is created in thinLTOBackendTask function(tools/gold/gold-plugin.cpp). linkInModule function, which is called by thinLTOBackendTask, calls the ‘move’ function of this IRMover. The other IRMover is created when “TheLinker” is created in FunctionImporter::importFunctions (lib/Transforms/IPO/FunctionImport.cpp). thinLTOBackendTask invokes FunctionImporeter::importFunctions as well, with a call chain of thinLTOBackendTask -->CodeGen::runAll (tools/gold/gold-plugin.cpp) --> CodeGen::runLTOPasses ((tools/gold/gold-plugin.cpp) --> FunctionImporter::importFunctions.

As these two IRMovers share the same destination module, when the second IRMover tries to map the metadata already mapped by the first IRMover, it eventually results the assertion failure. It seems that IRMover maintains SharedMDs to keep the metadata mapping record across the multiple calls of its move function, but that doesn’t help between two separate IRMovers.

What would be the right fix for this? Please let me know if I misunderstand something.

Thanks,
Taewook


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


More information about the llvm-dev mailing list