[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 14 12:43:18 PST 2021


JonChesterfield added a comment.

Changing the has-constant-initialiser check to a more precise/robust one sounds reasonable to me.

In D115661#3193157 <https://reviews.llvm.org/D115661#3193157>, @arsenm wrote:

> The backend also knows because the constant flag is set on the global variable. Addrspace(4) is a kludge which is largely redundant with other mechanisms for indicating constants

There's an interesting edge case here - we might want variables that are assigned to from a global ctor and subsequently constant, in which case they are not 'constant' as far as IR is concerned, but they are amenable to scalar loads and will be invariant once loaded. Some tables of data that are computed once in a .ctor kernel launch and then read by other kernels. I'm not totally sure how to express that pattern in IR though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115661/new/

https://reviews.llvm.org/D115661



More information about the cfe-commits mailing list