diff options
author | Justin Holewinski <jholewinski@nvidia.com> | 2015-02-02 21:05:49 +0000 |
---|---|---|
committer | Justin Holewinski <jholewinski@nvidia.com> | 2015-02-02 21:05:49 +0000 |
commit | f37f3d35eb4f3bf4a69cfc4eedaea1caa43d096c (patch) | |
tree | 6d1f2af88524a58ee1fc703c471c4748c5326cbd /clang/test/CodeGenCUDA | |
parent | 2f746d4c943a59626925ac625583ddc081b34388 (diff) | |
download | bcm5719-llvm-f37f3d35eb4f3bf4a69cfc4eedaea1caa43d096c.tar.gz bcm5719-llvm-f37f3d35eb4f3bf4a69cfc4eedaea1caa43d096c.zip |
When generating llvm.used, we may need an addrspacecast instead of a bitcast.
Summary:
This is especially important for targets that use multiple address spaces,
and commonly place global variables in address spaces other than zero.
Fixes PR22383
Test Plan: New test case added: llvm-used.cu
Reviewers: jingyue
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7345
llvm-svn: 227861
Diffstat (limited to 'clang/test/CodeGenCUDA')
-rw-r--r-- | clang/test/CodeGenCUDA/llvm-used.cu | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CodeGenCUDA/llvm-used.cu b/clang/test/CodeGenCUDA/llvm-used.cu new file mode 100644 index 00000000000..44666a91c3b --- /dev/null +++ b/clang/test/CodeGenCUDA/llvm-used.cu @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple nvptx64-unknown-unknown | FileCheck %s + + +// Make sure we emit the proper addrspacecast for llvm.used. PR22383 exposed an +// issue where we were generating a bitcast instead of an addrspacecast. + +// CHECK: @llvm.used = appending global [1 x i8*] [i8* addrspacecast (i8 addrspace(1)* bitcast ([0 x i32] addrspace(1)* @a to i8 addrspace(1)*) to i8*)], section "llvm.metadata" +__attribute__((device)) __attribute__((__used__)) int a[] = {}; |