1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2 ; These tests check the optimizations specific to
3 ; pointers being relocated at a statepoint.
8 define i1 @test_negative(i32 addrspace(1)* %p) gc "statepoint-example" {
10 %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
11 %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
12 %cmp = icmp eq i32 addrspace(1)* %pnew, null
14 ; CHECK-LABEL: test_negative
15 ; CHECK: %pnew = call i32 addrspace(1)*
19 define i1 @test_nonnull(i32 addrspace(1)* nonnull %p) gc "statepoint-example" {
21 %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %p)
22 %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
23 %cmp = icmp eq i32 addrspace(1)* %pnew, null
25 ; CHECK-LABEL: test_nonnull
29 define i1 @test_null() gc "statepoint-example" {
31 %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* null)
32 %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
33 %cmp = icmp eq i32 addrspace(1)* %pnew, null
35 ; CHECK-LABEL: test_null
40 define i1 @test_undef() gc "statepoint-example" {
42 %safepoint_token = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @func, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* undef)
43 %pnew = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 7, i32 7)
44 %cmp = icmp eq i32 addrspace(1)* %pnew, null
46 ; CHECK-LABEL: test_undef
51 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
52 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32) #3