[PATCH] D22538: [AMDGPU] Emit read-only data to .rodata for hsa
Konstantin Zhuravlyov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 15:01:13 PDT 2016
kzhuravl created this revision.
kzhuravl added a reviewer: tstellarAMD.
kzhuravl added a subscriber: llvm-commits.
Herald added subscribers: kzhuravl, arsenm.
https://reviews.llvm.org/D22538
Files:
lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
test/CodeGen/AMDGPU/global-constant.ll
test/CodeGen/AMDGPU/hsa-globals.ll
Index: test/CodeGen/AMDGPU/hsa-globals.ll
===================================================================
--- test/CodeGen/AMDGPU/hsa-globals.ll
+++ test/CodeGen/AMDGPU/hsa-globals.ll
@@ -38,7 +38,7 @@
; ASM: .size external_global_program, 4
; ASM: .type internal_readonly, at object
-; ASM: .text
+; ASM: .section .rodata.cst4,"aM", at progbits,4
; ASM: internal_readonly:
; ASM: .long 0
; ASM: .size internal_readonly, 4
Index: test/CodeGen/AMDGPU/global-constant.ll
===================================================================
--- test/CodeGen/AMDGPU/global-constant.ll
+++ test/CodeGen/AMDGPU/global-constant.ll
@@ -12,7 +12,7 @@
; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], readonly
; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], 0
; NOHSA: .text
-; HSA: .text
+; HSA: .section .rodata
; GCN: readonly:
; GCN: readonly2:
define void @main(i32 %index, float addrspace(1)* %out) {
Index: lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
+++ lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
@@ -24,7 +24,8 @@
SectionKind Kind,
Mangler &Mang,
const TargetMachine &TM) const {
- if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GV))
+ if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GV) &&
+ TM.getTargetTriple().getOS() != Triple::AMDHSA)
return TextSection;
return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22538.64570.patch
Type: text/x-patch
Size: 1656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/df584b0d/attachment.bin>
More information about the llvm-commits
mailing list