summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2015-06-30 17:18:00 +0000
committerSamuel Antao <sfantao@us.ibm.com>2015-06-30 17:18:00 +0000
commit8f1e30d67ce713c4f94f13a9764b59c05fefb90d (patch)
tree11b62b960d34c31a15c7277e491685d2386178be
parent171129e7eb531593fe6e44bd8fef2061335cec03 (diff)
Force relocation mode to be default, regardless of what is passed to the backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241081 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp5
-rw-r--r--test/CodeGen/NVPTX/globals_lowering.ll15
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp b/lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp
index 8a28b089ce3..221d2f093ae 100644
--- a/lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp
+++ b/lib/Target/NVPTX/MCTargetDesc/NVPTXMCTargetDesc.cpp
@@ -54,7 +54,10 @@ createNVPTXMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
static MCCodeGenInfo *createNVPTXMCCodeGenInfo(
StringRef TT, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) {
MCCodeGenInfo *X = new MCCodeGenInfo();
- X->initMCCodeGenInfo(RM, CM, OL);
+
+ // The default relocation model is used regardless of what the client has
+ // specified, as it is the only relocation model currently supported.
+ X->initMCCodeGenInfo(Reloc::Default, CM, OL);
return X;
}
diff --git a/test/CodeGen/NVPTX/globals_lowering.ll b/test/CodeGen/NVPTX/globals_lowering.ll
new file mode 100644
index 00000000000..84c61ef4033
--- /dev/null
+++ b/test/CodeGen/NVPTX/globals_lowering.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 -relocation-model=static | FileCheck %s --check-prefix CHK
+
+%MyStruct = type { i32, i32, float }
+@Gbl = internal addrspace(3) global [1024 x %MyStruct] zeroinitializer
+
+; CHK-LABEL: foo
+define void @foo(float %f) {
+entry:
+ ; CHK: ld.shared.f32 %{{[a-zA-Z0-9]+}}, [Gbl+8];
+ %0 = load float, float addrspace(3)* getelementptr inbounds ([1024 x %MyStruct], [1024 x %MyStruct] addrspace(3)* @Gbl, i32 0, i32 0, i32 2)
+ %add = fadd float %0, %f
+ ; CHK: st.shared.f32 [Gbl+8], %{{[a-zA-Z0-9]+}};
+ store float %add, float addrspace(3)* getelementptr inbounds ([1024 x %MyStruct], [1024 x %MyStruct] addrspace(3)* @Gbl, i32 0, i32 0, i32 2)
+ ret void
+}