[PATCH] D31735: ThinLTOBitcodeWriter: delete comdats if their keys are renamed

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 17:16:10 PDT 2017


pcc added a subscriber: rnk.
pcc added a comment.

It isn't clear whether this does the right thing if the comdat contains associated members, only some of which need to be moved to the merged module. Although I believe that the frontend will never attach !type metadata to a global in a comdat with associated members, the asan globals feature could add an associated member to such a comdat.

An optimal fix would be to rename the comdat to match the symbol name and ensure that all comdat members are moved to the merged module if any member needs to be moved. But I think it would also be valid to remove the comdats from both modules, as this change (almost) does.



================
Comment at: lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp:79
+        if (ComdatsToDelete.count(C->getName()))
+          GO->setComdat(nullptr);
+        else if (C->getName() != ExportGV.getName())
----------------
I think it would be simpler to do two passes over global_values, one where you decide which comdats to delete and the other where you delete them.


https://reviews.llvm.org/D31735





More information about the llvm-commits mailing list