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