LLVM/project 77d3f8aclang/docs UsersManual.rst, clang/lib/CodeGen CodeGenTBAA.cpp

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

While there are no special rules in the standards regarding void
pointers and strict aliasing, emitting distinct tags for void pointers
break some common idioms and there is no good alternative to re-write
the code without strict-aliasing violations. An example is to count the
entries in an array of pointers:

    int count_elements(void * values) {
      void **seq = values;
      int count;
      for (count = 0; seq && seq[count]; count++);
      return count;
    }

https://clang.godbolt.org/z/8dTv51v8W

An example in the wild is from
https://github.com/llvm/llvm-project/issues/119099

This patch avoids emitting distinct tags for void pointers, to avoid
those idioms causing mis-compiles for now.

Fixes https://github.com/llvm/llvm-project/issues/119099.
Fixes https://github.com/llvm/llvm-project/issues/122537.

PR: https://github.com/llvm/llvm-project/pull/122116
DeltaFile
+79-9clang/docs/UsersManual.rst
+12-13clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+3-10clang/test/CodeGen/tbaa-pointers.c
+3-9clang/unittests/CodeGen/TBAAMetadataTest.cpp
+8-0clang/lib/CodeGen/CodeGenTBAA.cpp
+105-415 files

UnifiedSplitRaw