1 ; RUN: llc < %s -fast-isel
3 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-linux-gnu"
5 ; Dont crash with gc intrinsics.
7 ; gcrelocate call should not be an LLVM Machine Block by itself.
8 define ptr addrspace(1) @test_gcrelocate(ptr addrspace(1) %v) gc "statepoint-example" {
10 %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]
11 %vnew = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 0, i32 0)
12 ret ptr addrspace(1) %vnew
15 ; gcresult calls are fine in their own blocks.
16 define i1 @test_gcresult() gc "statepoint-example" {
18 %safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)
19 %call1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
25 ; we are okay here because we see the gcrelocate and avoid generating their own
27 define i1 @test_gcresult_gcrelocate(ptr addrspace(1) %v) gc "statepoint-example" {
29 %safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]
30 %call1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
31 %vnew = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %safepoint_token, i32 0, i32 0)
37 define ptr addrspace(1) @test_non_entry_block(ptr addrspace(1) %v, i8 %val) gc "statepoint-example" {
39 %load = load i8, ptr addrspace(1) %v
40 %cmp = icmp eq i8 %load, %val
41 br i1 %cmp, label %func_call, label %exit
45 %tok = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) ["gc-live"(ptr addrspace(1) %v)]
46 %vnew = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 0, i32 0)
47 ret ptr addrspace(1) %vnew
50 ret ptr addrspace(1) %v
57 declare zeroext i1 @return_i1()
58 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
59 declare i1 @llvm.experimental.gc.result.i1(token)
60 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)