According to D78952, we should not be making assumption about the size (and thus dereferencability) of globals that don't have a definitive initializer.
This is a draft patch to make the implementation comply with the specification, though I haven't fixed all test failures yet:
Failed Tests (17): LLVM :: CodeGen/AArch64/GlobalISel/constant-dbg-loc.ll LLVM :: CodeGen/AArch64/GlobalISel/localizer-arm64-tti.ll LLVM :: CodeGen/AArch64/csr-split.ll LLVM :: CodeGen/AMDGPU/GlobalISel/irtranslator-invariant.ll LLVM :: CodeGen/PowerPC/GlobalISel/ppc-irtranslator-stackprotect.ll LLVM :: CodeGen/PowerPC/aix-cc-abi.ll LLVM :: CodeGen/PowerPC/aix-cc-byval.ll LLVM :: CodeGen/PowerPC/ctrloops-pseudo.ll LLVM :: CodeGen/PowerPC/lower-globaladdr32-aix.ll LLVM :: CodeGen/PowerPC/lower-globaladdr64-aix.ll LLVM :: CodeGen/PowerPC/out-of-range-dform.ll LLVM :: CodeGen/SystemZ/int-cmp-59.ll LLVM :: CodeGen/X86/fold-sext-trunc.ll LLVM :: CodeGen/X86/pr32610.ll LLVM :: CodeGen/X86/pr37916.ll LLVM :: CodeGen/X86/remat-constant.ll LLVM-Unit :: Analysis/./AnalysisTests/LoadsTest/CanReplacePointersIfEqual
Alternatively, we should change the spec to permit our current assumption of a minimum size