1 ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s
3 declare void @consume(...)
5 ; Test to make sure we destroy LCSSA's single entry phi nodes before
7 define void @test6(i64 addrspace(1)* %obj) gc "statepoint-example" {
14 ; CHECK-NEXT: gc.statepoint
15 ; CHECK-NEXT: gc.relocate
17 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
18 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
19 %obj2 = phi i64 addrspace(1)* [ %obj, %entry ]
20 call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0)
21 call void (...) @consume(i64 addrspace(1)* %obj2)
22 call void (...) @consume(i64 addrspace(1)* %obj)
26 declare void @some_call(i64 addrspace(1)*)
28 ; Need to delete unreachable gc.statepoint call
29 define void @test7() gc "statepoint-example" {
31 ; CHECK-NOT: gc.statepoint
35 %obj = phi i64 addrspace(1)* [null, %unreached]
36 call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0)
37 call void (...) @consume(i64 addrspace(1)* %obj)
41 ; Need to delete unreachable gc.statepoint invoke - tested seperately given
42 ; a correct implementation could only remove the instructions, not the block
43 define void @test8() gc "statepoint-example" personality i32 ()* undef {
45 ; CHECK-NOT: gc.statepoint
49 invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0)
50 to label %normal_return unwind label %exceptional_return
52 normal_return: ; preds = %entry
55 exceptional_return: ; preds = %entry
56 %landing_pad4 = landingpad { i8*, i32 }
62 ; Bound the last check-not
65 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)