[PATCH] D16501: [CUDA] Don't generate aliases for static extern "C" functions.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 25 14:40:49 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258734: [CUDA] Don't generate aliases for static extern "C" functions. (authored by jlebar).
Changed prior to commit:
http://reviews.llvm.org/D16501?vs=45781&id=45919#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16501
Files:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCUDA/alias.cu
Index: cfe/trunk/test/CodeGenCUDA/alias.cu
===================================================================
--- cfe/trunk/test/CodeGenCUDA/alias.cu
+++ cfe/trunk/test/CodeGenCUDA/alias.cu
@@ -0,0 +1,17 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm \
+// RUN: -o - %s | FileCheck %s
+
+#include "Inputs/cuda.h"
+
+// Check that we don't generate an alias from "foo" to the mangled name for
+// ns::foo() -- nvptx doesn't support aliases.
+
+namespace ns {
+extern "C" {
+// CHECK-NOT: @foo = internal alias
+__device__ __attribute__((used)) static int foo() { return 0; }
+}
+}
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -3836,6 +3836,10 @@
/// to such functions with an unmangled name from inline assembly within the
/// same translation unit.
void CodeGenModule::EmitStaticExternCAliases() {
+ // Don't do anything if we're generating CUDA device code -- the NVPTX
+ // assembly target doesn't support aliases.
+ if (Context.getTargetInfo().getTriple().isNVPTX())
+ return;
for (auto &I : StaticExternCValues) {
IdentifierInfo *Name = I.first;
llvm::GlobalValue *Val = I.second;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16501.45919.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160125/fed33235/attachment.bin>
More information about the cfe-commits
mailing list