[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

Bruno De Fraine via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 02:54:51 PST 2025


brunodf-snps wrote:

I read about this commit in LLVM weekly. Thanks @fhahn and @rjmccall for adding documentation about strict aliasing! This is always a difficult topic for our users.

One remark though. The documentation states:
> `void*` is permitted to alias any pointer type, `void**` is permitted to alias any pointer to pointer type, and so on.

This is not what was implemented here? Both `void*` and `void**` get the same TBAA tag:
https://clang.godbolt.org/z/b1ob8vnjc
If I understand correctly, current TBAA will not conclude NoAlias between a `void**` and an `int*` access, while the documentation suggests that it will. (Without knowing too much about the background of this change, I'd find the approach of the documentation sensible.)

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


More information about the cfe-commits mailing list