summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2016-01-15 23:57:53 +0000
committerArtem Belevich <tra@google.com>2016-01-15 23:57:53 +0000
commit5be0706ebe1616687ce9bf0e9d558a0bf97b85dc (patch)
tree8b3c5fbef450ad2f9454ebe36b69fc3e12326008
parentf2f92f14740b44f8afbeeddfdfa6d97f1126f7b3 (diff)
downloadbcm5719-llvm-5be0706ebe1616687ce9bf0e9d558a0bf97b85dc.tar.gz
bcm5719-llvm-5be0706ebe1616687ce9bf0e9d558a0bf97b85dc.zip
[NVPTX] Do not emit .hidden or .protected directives as they are not allowed by PTX.
llvm-svn: 257961
-rw-r--r--llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp3
-rw-r--r--llvm/test/CodeGen/NVPTX/global-visibility.ll16
2 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
index ef36c13b49f..8c04db1faf7 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
@@ -41,6 +41,9 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Triple &TheTriple) {
// PTX does not allow .align on functions.
HasFunctionAlignment = false;
HasDotTypeDotSizeDirective = false;
+ // PTX does not allow .hidden or .protected
+ HiddenDeclarationVisibilityAttr = HiddenVisibilityAttr = MCSA_Invalid;
+ ProtectedVisibilityAttr = MCSA_Invalid;
Data8bitsDirective = " .b8 ";
Data16bitsDirective = " .b16 ";
diff --git a/llvm/test/CodeGen/NVPTX/global-visibility.ll b/llvm/test/CodeGen/NVPTX/global-visibility.ll
new file mode 100644
index 00000000000..90af2950fb4
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/global-visibility.ll
@@ -0,0 +1,16 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+; PTX does not support .hidden or .protected.
+; Make sure we do not emit them.
+
+define hidden void @f_hidden() {
+ ret void
+}
+; CHECK-NOT: .hidden
+; CHECK: .visible .func f_hidden
+
+define protected void @f_protected() {
+ ret void
+}
+; CHECK-NOT: .protected
+; CHECK: .visible .func f_protected
OpenPOWER on IntegriCloud