[all-commits] [llvm/llvm-project] 458b1e: [TBAA] Refine pointer-tbaa for void pointers by po...

Bruno De Fraine via All-commits all-commits at lists.llvm.org
Thu Feb 20 04:07:18 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 458b1e9d2c61945f62b5bdfda93914d6a46b6cc7
      https://github.com/llvm/llvm-project/commit/458b1e9d2c61945f62b5bdfda93914d6a46b6cc7
  Author: Bruno De Fraine <brunodf at synopsys.com>
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
    M clang/lib/CodeGen/CodeGenTBAA.cpp
    M clang/lib/CodeGen/CodeGenTBAA.h
    M clang/test/CXX/drs/cwg158.cpp
    M clang/test/CodeGen/tbaa-pointers.c

  Log Message:
  -----------
  [TBAA] Refine pointer-tbaa for void pointers by pointer depth (#126047)

Commit 77d3f8a avoids distinct tags for any pointers where the ultimate
pointee type is `void`, to solve breakage in real-world code that uses
(indirections to) `void*` for polymorphism over different pointer types.

While this matches the TBAA implementation in GCC, this patch implements
a refinement that distinguishes void pointers by pointer depth, as
described in the "strict aliasing" documentation included in the
aforementioned commit:
> `void*` is permitted to alias any pointer type, `void**` is permitted
> to alias any pointer to pointer type, and so on.

For example, `void**` is no longer considered to alias `int*` in this
refinement, but it remains possible to use `void**` for polymorphism
over pointers to pointers.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list