[llvm] r211941 - [NVPTX] Emit .weak linkage for link_once, weak, available_externally, and common linkage
Justin Holewinski
jholewinski at nvidia.com
Fri Jun 27 11:35:56 PDT 2014
Author: jholewinski
Date: Fri Jun 27 13:35:56 2014
New Revision: 211941
URL: http://llvm.org/viewvc/llvm-project?rev=211941&view=rev
Log:
[NVPTX] Emit .weak linkage for link_once, weak, available_externally, and common linkage
Added:
llvm/trunk/test/CodeGen/NVPTX/weak-global.ll
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=211941&r1=211940&r2=211941&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Fri Jun 27 13:35:56 2014
@@ -1367,6 +1367,10 @@ void NVPTXAsmPrinter::printModuleLevelGV
O << ".visible ";
else
O << ".extern ";
+ } else if (GVar->hasLinkOnceLinkage() || GVar->hasWeakLinkage() ||
+ GVar->hasAvailableExternallyLinkage() ||
+ GVar->hasCommonLinkage()) {
+ O << ".weak ";
}
if (llvm::isTexture(*GVar)) {
Added: llvm/trunk/test/CodeGen/NVPTX/weak-global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/NVPTX/weak-global.ll?rev=211941&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/NVPTX/weak-global.ll (added)
+++ llvm/trunk/test/CodeGen/NVPTX/weak-global.ll Fri Jun 27 13:35:56 2014
@@ -0,0 +1,9 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+; CHECK: .weak .global .align 4 .u32 g
+ at g = common addrspace(1) global i32 zeroinitializer
+
+define i32 @func0() {
+ %val = load i32 addrspace(1)* @g
+ ret i32 %val
+}
More information about the llvm-commits
mailing list