Re: Addition of compiler flag for dynamic_cast optimization

2025-07-15 Thread Thomas de Bock via Gcc
Subject: [ext] Re: Addition of compiler flag for dynamic_cast optimization On Mon, Jul 14 2025, Jonathan Wakely via Gcc wrote: > On Mon, 14 Jul 2025 at 14:57, Thomas de Bock via Gcc wrote: >> >> Hello all, I've been looking into a compiler optimization implemented by >&

Re: Addition of compiler flag for dynamic_cast optimization

2025-07-14 Thread Thomas de Bock via Gcc
4 To: Thomas de Bock Cc: gcc@gcc.gnu.org Subject: [ext] Re: Addition of compiler flag for dynamic_cast optimization On Mon, 14 Jul 2025 at 14:57, Thomas de Bock via Gcc wrote: > > Hello all, I've been looking into a compiler optimization implemented by > clang but not gcc that substi

Addition of compiler flag for dynamic_cast optimization

2025-07-14 Thread Thomas de Bock via Gcc
Hello all, I've been looking into a compiler optimization implemented by clang but not gcc that substitutes a __dynamic_cast call for a simple vtable ptr comparison in the case that the class being cast to is final. However this brings issues with it in some cases (specified in thread). I belie

Re: Offset vtable address

2025-07-07 Thread Thomas de Bock via Gcc
Managed to get it working with: tree index = build_int_cst (NULL_TREE, -2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE); tree src_vptr = build_address(build_vtbl_ref(src_obj, index)); tree trgt_vtbl_decl = get_vtable_decl(target_type, 0); tree trgt_vtbl_addr =

Offset vtable address

2025-07-07 Thread Thomas de Bock via Gcc
Currently working with the C++-frontend, I am trying to compare the addresses of the "trgt" (originally a type) and "src" (originally a class instance) vtables. Currently I am successfully retrieving the vptr value of the src instance at runtime, and the vtable address of the trgt at compiletim

Re: Compiler optimization help

2025-07-06 Thread Thomas de Bock via Gcc
mean I now know I cannot compare the type info in this way, but are there any already implemented functions that let you retrieve the vtable and the address of the base class vtable from a type that someone could point me to? From: Thomas de Bock Sent: 04 July 20

Re: building generic tree to compare base classes at runtime

2025-07-06 Thread Thomas de Bock via Gcc
Bock via Gcc Sent: 06 July 2025 16:46:16 To: gcc@gcc.gnu.org Subject: [ext] building generic tree to compare base classes at runtime Hello, currently working on a tiny experimental compiler optimization in the C++ frontend. Trying to compare the base classes of 2 types at runtime, then if they

building generic tree to compare base classes at runtime

2025-07-06 Thread Thomas de Bock via Gcc
Hello, currently working on a tiny experimental compiler optimization in the C++ frontend. Trying to compare the base classes of 2 types at runtime, then if they are equal, statically cast the second operand's type to the first and the tree should return the now-casted ptr of the second operand,

Compiler optimization help

2025-07-04 Thread Thomas de Bock via Gcc
Hello, I'm looking to contribute to the project, hoping to implement the compiler optimization specified in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63164. Would appreciate any help/tips regarding what files I should look at to start working towards implementing something like this, cheers