1; RUN: opt < %s -O3 -S | FileCheck %s
2
3; Address space intrinsics were erroneously marked NoCapture, leading to bad
4; optimizations (such as the store below being eliminated as dead code). This
5; test makes sure we don't regress.
6
7declare void @foo(i32 addrspace(1)*)
8
9declare i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32*)
10
11; CHECK: @bar
12define void @bar() {
13  %t1 = alloca i32
14; CHECK: call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* nonnull %t1)
15; CHECK-NEXT: store i32 10, i32* %t1
16  %t2 = call i32 addrspace(1)* @llvm.nvvm.ptr.gen.to.global.p1i32.p0i32(i32* %t1)
17  store i32 10, i32* %t1
18  call void @foo(i32 addrspace(1)* %t2)
19  ret void
20}
21
22