[all-commits] [llvm/llvm-project] 8be816: [clang][CodeGen] Stop overriding GlobalVariable's ...

Marcos Maronas via All-commits all-commits at lists.llvm.org
Thu Sep 10 06:18:16 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8be8161a037daf2417c669336b777e986d0fc21f
      https://github.com/llvm/llvm-project/commit/8be8161a037daf2417c669336b777e986d0fc21f
  Author: Marcos Maronas <mmaronas at amd.com>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M clang/include/clang/CodeGen/ConstantInitBuilder.h
    M clang/lib/CodeGen/ConstantInitBuilder.cpp
    M clang/test/CodeGenCXX/constructor-attr.cpp
    M clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
    M clang/test/OpenMP/amdgcn_target_global_constructor.cpp

  Log Message:
  -----------
  [clang][CodeGen] Stop overriding GlobalVariable's default address space (#222367)

The `GlobalVariable` constructor used by `createGlobal` receives a
`std::optional<unsigned> AddressSpace` that, when unspecified, falls
back to `M.getDataLayout().getDefaultGlobalsAddressSpace()`. However,
`createGlobal`'s `AddressSpace` arg was a bare `unsigned` defaulting to
0. By doing that, it was effectively overriding the `GlobalVariable`'s
constructor fallback with 0. On targets whose default globals address
space is not 0 (AMDGPU, SPIR/SPIR-V), this emitted
`@llvm.global_ctors/dtors` in address space 0 causing some issues (see
https://github.com/ROCm/SPIRV-LLVM-Translator/issues/293).



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