[libcxx-commits] [PATCH] D137315: [libc++abi] Improve performance of __dynamic_cast

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 14 09:08:48 PST 2022


EricWF added a comment.

Do you know why the hint wasn't initially used? Was there a point where compilers didn't actually provide the hints?

Also, do you think there would be a way to split this change into two? One that does the refactoring without changing behavior, and another (hopefully much smaller) change that starts taking advantage of the src2dst_offset hint?

I think it would be much easier to understand the changes here if they were separated from the nice cleanup that was done here.



================
Comment at: libcxxabi/src/private_typeinfo.cpp:260
+    // Initialize info struct for this search.
+    __dynamic_cast_info info = {
+        dst_type,
----------------
Would it be better to pass this struct in rather than taking a bunch of very similar parameters with the same type as function arguments?

It seems like that would be less bug prone.


================
Comment at: libcxxabi/src/private_typeinfo.cpp:866
+    derived_object_info derived_info;
+    dyn_cast_get_derived_info(&derived_info, static_ptr);
 
----------------
Seems like it would be a better API to have `dyn_cast_get_derived_info` to return the info struct rather than taking it as an input parameter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137315



More information about the libcxx-commits mailing list