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

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 17:48:02 PDT 2017


inglorion added inline comments.


================
Comment at: lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp:79
+        if (ComdatsToDelete.count(C->getName()))
+          GO->setComdat(nullptr);
+        else if (C->getName() != ExportGV.getName())
----------------
pcc wrote:
> 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.
Definitely simpler. Are you ok with iterating all the globals again? This more complex implementation tries to avoid some of the work by immediately deleting references to comdats already slated for deletion and indexing globals by comdat to avoid having to iterate over all the globals again (based on the assumption that most globals either won't have a comdat or the comdat will have the same name as the global).

Also, did you want me to iterate over the symbols in ImportM as well (as per your "remove the comdats from both modules")?


https://reviews.llvm.org/D31735





More information about the llvm-commits mailing list