* Hanke Zhang via Gcc:

> I have recently been delving into optimizing dynamic_cast calls in C++
> within the context of GIMPLE code. In particular, for scenarios
> involving single inheritance, I'm aiming to convert the following
> code:
>
> _1 = __dynamic_cast (obj_1(D), &_ZTI7Base, &_ZTI10Derived, 0);
> if (_1!= 0B)
>
> into a more direct and efficient form, such as:
>
> _2 = MEM[obj_1(D)];
> _3 = MEM[_2 + -8B];
> if (_3 == &_ZTI10Derived)
>
> However, during this process, I encountered an issue. I attempted to
> obtain the type node of the Derived class through the _ZTI10Derived,
> which I believe should be a VAR_DECL. Regrettably, my efforts were
> unsuccessful.

Is this for ELF?  I think our ELF ABIs require that a full string
comparison is performed if the pointers do not match.  Otherwise, types
with different vtables will suddenly be considered distinct under RTTI.
The symbols for vtables can be hidden if “local: *;” is used in a linker
script, for example.  Currently, as far as I understand it, this does
not have a direct impact on RTTI.

Thanks,
Florian

Reply via email to