Hi, 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. I'm reaching out to inquire if there's a viable method to achieve this. Specifically, is there a way to retrieve the type node of the original class from the third parameter of the __dynamic_cast call? Additionally, if there are any other aspects I should be aware of during this optimization process, I would greatly appreciate your insights. Thank you very much for your time and assistance. Best regards, Hanke Zhang