[PATCH] D154658: Optimize emission of `dynamic_cast` to final classes.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 17:38:17 PDT 2023


rjmccall added a comment.

I don't think it's an intended guarantee of the Itanium ABI that the v-table will be unique, and v-tables are frequently not unique in the presence of shared libraries.  They should be unique for classes with internal linkage, but of course that's a vastly reduced domain for the optimization.  We could do an RTTI comparison in the general case, either inline or by synthesizing a helper function to compare two `std::type_info`s.  Or you could have a flag to tell you to make stronger uniqueness assumptions.

If there are multiple subobjects of the source type in the destination type, consider just casting to `void*` first instead of doing multiple comparisons.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154658



More information about the cfe-commits mailing list