[PATCH] D65813: Partially revert D61491 "AMDGPU: Be explicit about whether the high-word in SI_PC_ADD_REL_OFFSET is 0"

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 09:07:43 PDT 2019


foad created this revision.
foad added reviewers: nhaehnle, arsenm, tpr.
Herald added subscribers: hiraditya, t-tye, dstuttard, yaxunl, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

D61491 <https://reviews.llvm.org/D61491> caused us to use relocs when they're not strictly necessary, to
refer to symbols in the text section. This is a pessimization and it's a
problem for some loaders that don't support relocs yet.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65813

Files:
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/test/CodeGen/AMDGPU/llvm.memcpy.ll
  llvm/test/CodeGen/AMDGPU/no-initializer-constant-addrspace.ll


Index: llvm/test/CodeGen/AMDGPU/no-initializer-constant-addrspace.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/no-initializer-constant-addrspace.ll
+++ llvm/test/CodeGen/AMDGPU/no-initializer-constant-addrspace.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -march=amdgcn -mcpu=tonga -filetype=obj < %s | llvm-readobj -r --symbols | FileCheck %s -check-prefix=GCN
 ; RUN: llc -march=r600 -mcpu=cypress -filetype=obj < %s | llvm-readobj -r --symbols | FileCheck %s -check-prefix=EG
 
-; GCN: R_AMDGPU_REL32_LO extern_const_addrspace
+; GCN: R_AMDGPU_REL32 extern_const_addrspace
 ; EG: R_AMDGPU_ABS32 extern_const_addrspace
 
 ; CHECK-DAG: Name: extern_const_addrspace
Index: llvm/test/CodeGen/AMDGPU/llvm.memcpy.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/llvm.memcpy.ll
+++ llvm/test/CodeGen/AMDGPU/llvm.memcpy.ll
@@ -333,7 +333,7 @@
 
 ; FUNC-LABEL: {{^}}test_memcpy_const_string_align4:
 ; SI: s_getpc_b64
-; SI: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, hello.align4 at rel32@lo+20
+; SI: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, hello.align4+20
 ; SI: s_addc_u32
 ; SI-DAG: s_load_dwordx4
 ; SI-DAG: s_load_dwordx4
Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -5028,11 +5028,8 @@
   // of the s_add_u32 instruction, we end up with an offset that is 4 bytes too
   // small. This requires us to add 4 to the global variable offset in order to
   // compute the correct address.
-  unsigned LoFlags = GAFlags;
-  if (LoFlags == SIInstrInfo::MO_NONE)
-    LoFlags = SIInstrInfo::MO_REL32;
   SDValue PtrLo =
-      DAG.getTargetGlobalAddress(GV, DL, MVT::i32, Offset + 4, LoFlags);
+      DAG.getTargetGlobalAddress(GV, DL, MVT::i32, Offset + 4, GAFlags);
   SDValue PtrHi;
   if (GAFlags == SIInstrInfo::MO_NONE) {
     PtrHi = DAG.getTargetConstant(0, DL, MVT::i32);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65813.213634.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190806/8c181c6d/attachment.bin>


More information about the llvm-commits mailing list