[all-commits] [llvm/llvm-project] e52ae3: [CIR] Propagate the record address space to get_me...

David Rivera via All-commits all-commits at lists.llvm.org
Sat Sep 26 00:01:03 PDT 2026


  Branch: refs/heads/users/riverdave/cir/getmember-addrspace
  Home:   https://github.com/llvm/llvm-project
  Commit: e52ae3f7ea7c4b9fd31209252a0e64a583a6b94a
      https://github.com/llvm/llvm-project/commit/e52ae3f7ea7c4b9fd31209252a0e64a583a6b94a
  Author: David Rivera <davidriverg at gmail.com>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenAsm.cpp
    M clang/lib/CIR/CodeGen/CIRGenBuilder.h
    M clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
    M clang/lib/CIR/CodeGen/CIRGenExpr.cpp
    M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
    A clang/test/CIR/CodeGen/get-member-addrspace.cpp
    A clang/test/CIR/CodeGenHIP/inline-asm-multi-output-addrspace.hip
    M clang/test/CIR/CodeGenSYCL/kernel-caller-address-space.cpp
    M clang/test/CIR/IR/invalid-struct.cir

  Log Message:
  -----------
  [CIR] Propagate the record address space to get_member

A member is stored inside its record, so a pointer to it is in the same
address space as the record. Several get_member builders created the
result pointer in the default address space regardless of the base:

  cir.get_member %p[0] : !cir.ptr<!rec_S, target_address_space(4)>
                      -> !cir.ptr<!s32i>

On SPIR-V the default address space is private, so a SYCL kernel reading
a captured pointer from its closure (in the generic address space) went
through a private pointer. For unions, lowering emitted a bitcast that
changed the address space, which is invalid LLVM IR.

Take the address space from the base in emitAddrOfFieldStorage,
getAddrOfBitFieldStorage, the Address-based createGetMember, multi-output
inline asm (whose temporary is an AS 5 alloca on AMDGPU) and the NVPTX
printf argument buffer. Add a verifier check so a mismatch fails early.



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