summaryrefslogtreecommitdiff
path: root/test/CodeGen/NVPTX
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2013-02-11 18:56:35 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2013-02-11 18:56:35 +0000
commitff5adad9f39f60dc9f1caadef03b6aa7922ed168 (patch)
tree80c4f5563a4b5e01ac6e3c04c92a31c59eb1bb7c /test/CodeGen/NVPTX
parentb1a82589339fed148c12b052d30861a539552f1a (diff)
downloadllvm-ff5adad9f39f60dc9f1caadef03b6aa7922ed168.tar.gz
llvm-ff5adad9f39f60dc9f1caadef03b6aa7922ed168.tar.bz2
llvm-ff5adad9f39f60dc9f1caadef03b6aa7922ed168.tar.xz
[NVPTX] Remove NoCapture from address space conversion intrinsics. NoCapture is not valid in this case, and was causing incorrect optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/NVPTX')
-rw-r--r--test/CodeGen/NVPTX/intrin-nocapture.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/NVPTX/intrin-nocapture.ll b/test/CodeGen/NVPTX/intrin-nocapture.ll
new file mode 100644
index 0000000000..55781bb15a
--- /dev/null
+++ b/test/CodeGen/NVPTX/intrin-nocapture.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -O3 -S | FileCheck %s
+
+; Address space intrinsics were erroneously marked NoCapture, leading to bad
+; optimizations (such as the store below being eliminated as dead code). This
+; test makes sure we don't regress.
+
+declare void @foo(i32 addrspace(1)*)
+
+declare i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32*)
+
+; CHECK: @bar
+define void @bar() {
+ %t1 = alloca i32
+; CHECK: call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* %t1)
+; CHECK-NEXT: store i32 10, i32* %t1
+ %t2 = call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* %t1)
+ store i32 10, i32* %t1
+ call void @foo(i32 addrspace(1)* %t2)
+ ret void
+}
+