[PATCH] D109114: [GlobalDCE] Add a mode to VFE that replaces unused vtable slots with a trap function instead of a NULL pointer

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 12:47:02 PDT 2021


pcc added a comment.

Oh right, I missed that you were emitting the function locally. So then replace "saves a PLT slot" with "saves emitting a trap function".

The PLT slot would be possible if it were an external function and you were using `dso_local_equivalent` to refer to it -- I'm not sure if you're doing that in Swift or even if the Mach-O side of that is implemented.

It seems that this should depend on what kind of relocation this is (absolute or relative), rather than a module flag. Because it's always possible that you'll want both modes in the same linkage unit (e.g. LTOing together C++ and Swift), and forcing everything to use the same mode will either produce invalid relocations or unnecessary relocations.

It doesn't seem too bad to look through the use list to find any ptrtoint references and then any sub references. At that point you can replace with 0, no need to look for the trunc as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109114/new/

https://reviews.llvm.org/D109114



More information about the llvm-commits mailing list