[all-commits] [llvm/llvm-project] 8acdcf: [Clang][CodeGen]`vtable`, `typeinfo` et al. are gl...

Alex Voicu via All-commits all-commits at lists.llvm.org
Wed Jul 19 10:05:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8acdcf4016876d122733991561be706b64026e73
      https://github.com/llvm/llvm-project/commit/8acdcf4016876d122733991561be706b64026e73
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M clang/lib/CodeGen/CGVTT.cpp
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    A clang/test/CodeGenCXX/vtable-align-address-space.cpp
    A clang/test/CodeGenCXX/vtable-assume-load-address-space.cpp
    A clang/test/CodeGenCXX/vtable-consteval-address-space.cpp
    A clang/test/CodeGenCXX/vtable-constexpr-address-space.cpp
    A clang/test/CodeGenCXX/vtable-key-function-address-space.cpp
    A clang/test/CodeGenCXX/vtable-layout-extreme-address-space.cpp
    A clang/test/CodeGenCXX/vtable-linkage-address-space.cpp
    A clang/test/CodeGenCXX/vtable-pointer-initialization-address-space.cpp
    M clang/test/CodeGenCXX/vtt-address-space.cpp
    A clang/test/CodeGenCXX/vtt-layout-address-space.cpp
    M clang/test/Headers/hip-header.hip

  Log Message:
  -----------
  [Clang][CodeGen]`vtable`, `typeinfo` et al. are globals

All data structures and values associated with handling virtual functions / inheritance, as well as RTTI, are globals and thus can only reside in the global address space. This was not taken fully taken into account because for most targets, global & generic appear to coincide. However, on targets where global & generic ASes differ (e.g. AMDGPU), this was problematic, since it led to the generation of invalid bitcasts (which would trigger asserts in Debug) and less than optimal code. This patch does two things:

ensures that vtables, vptrs, vtts, typeinfo are generated in the right AS, and populated accordingly;
removes a bunch of bitcasts which look like left-overs from the typed ptr era.

Reviewed By: yxsamliu

Differential Revision: https://reviews.llvm.org/D153092




More information about the All-commits mailing list