New attribute added to DataLayout: globals address space

Hello all,

I committed ⚙ D84345 [AMDGPU] Set the default globals address space to 1 yesterday, which adds a
new "-G<N>" field to the DataLayout and specifies the address space
that LLVM passes should use when creating new global variables if
there is no additional contextual information.

This change is required to improve support for targets that don't use
address space zero for globals (e.g. the CHERI RISC-V/MIPS targets and
Arm Morello) and is required to remove uses of
PointerType::getUnqual() and similar functions
([llvm-dev] [RFC] Requiring explicit address space arguments for PointerType).

This change should be fully backwards compatible: if your target
doesn't specify "-G" in the datalayout string all globals will be
created in AS0 as usual.
Please let me know if you have any concerns about this change.

Thanks,
Alex

Hi Alex,

I think my only concern here is that this affects forward compatibility - I don’t think there’s anything to be done about it, but it does mean that existing installed libraries will fail to read even the most basic of newer modules with this change and worth calling out explicitly.

-eric