[clang] [llvm] [Clang] Correct __builtin_dynamic_object_size for subobject types (PR #83204)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 15:09:44 PST 2024


bwendling wrote:

The first PR attempt was here: https://github.com/llvm/llvm-project/pull/78526

It was NACK'ed because it used the LLVM IR representation of the structure, which wasn't appropriate. To solve that issue, I chose to expand the `llvm.objectsize()` builtin to contain the size and offset of the sub-object, which is determined in the front-end.

Note that there are many other things wrong with our `__builtin_{dynamic_}object_size` implementations. For one, they perform loads of the pointer which isn't necessary and contrary to the idea that the builtins don't allow for side-effects. I'll be addressing those issues in future patches.

https://github.com/llvm/llvm-project/pull/83204


More information about the cfe-commits mailing list