[all-commits] [llvm/llvm-project] 57a041: [clang][CodeGen] Handle template parameter objects...

Alex Voicu via All-commits all-commits at lists.llvm.org
Tue Nov 28 16:15:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57a0416e0e8ccd522d4242dbe5d0d7893864a10a
      https://github.com/llvm/llvm-project/commit/57a0416e0e8ccd522d4242dbe5d0d7893864a10a
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    A clang/test/CodeGenCXX/template-param-objects-address-space.cpp

  Log Message:
  -----------
  [clang][CodeGen] Handle template parameter objects with explicit address spaces (#69266)

For certain cases (e.g. when their address is observable at run time) it
is necessary to provide physical backing for non-type template parameter
objects. Said backing comes in the form of a global variable. For
certain targets (e.g. AMDGPU), which use a non-default address space for
globals, this can lead to an issue when referencing said global in
address space agnostic languages (such as HIP), for example when passing
them to a function.

This patch addresses this issue by inserting an address space cast iff
there is an address space mismatch between the type of a reference
expression and the address space of the backing global. A test is also
added.




More information about the All-commits mailing list