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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits