[PATCH] D70947: Add a default address space for globals to DataLayout

Dylan McKay via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 16 20:08:54 PDT 2020


dylanmckay added a comment.

Reposting a comment from Matt from earlier

> Needs some bitcode compatibility tests, and actual uses. AMDGPU's data layout should also add -G1

I think that once these two things are done, then there is no reason to not merge this patch. It is well written, tested, and, if switched on for the AMDGPU target, useful to an in-tree backend.



================
Comment at: llvm/lib/IR/Globals.cpp:369
+                       ? *AddressSpace
+                       : M.getDataLayout().getDefaultGlobalsAddressSpace()),
       isConstantGlobal(constant),
----------------
Can we add a test that global variables do indeed get initialized with the address space specified in the DataLayout?

For example, compile under X86 but with `G7` in the data layout, then assert `addrspace(7)` in the IR output.

I think every other code path is covered.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70947





More information about the llvm-commits mailing list