[PATCH] D134589: [C++20][Modules] Elide unused guard variables in Itanium ABI module initializers.

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 04:47:14 PDT 2022


urnathan accepted this revision.
urnathan added a comment.
This revision is now accepted and ready to land.

This is ok, but see the note I added about object-file compatibility.



================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:646-647
+   If there are no initalizers at all (and also no imported modules) we reduce
+   this to an empty function (since importers of the  module will call this
+   unconditionally for the current implementation).
 
----------------
It's not just 'current implementation' requirement, it's an ABI requirement.  Remember, one could generate the interface object file from one compiler and then generate (and consume) the CMIs with a different compiler.  this achieves object-file interoperability, but does not require CMI compatibility. We have no expectation any particular compiler implements the optimization you refer to.

Feel free to note this at your discretion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134589



More information about the cfe-commits mailing list