1 ; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s
2 ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s
4 ; Test to make sure we destroy LCSSA's single entry phi nodes before
7 declare void @consume(...) "gc-leaf-function"
9 define void @test6(i64 addrspace(1)* %obj) gc "statepoint-example" {
14 next: ; preds = %entry
16 ; CHECK-NEXT: gc.statepoint
17 ; CHECK-NEXT: gc.relocate
19 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
20 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
21 ; Need to delete unreachable gc.statepoint call
22 %obj2 = phi i64 addrspace(1)* [ %obj, %entry ]
23 call void @foo() [ "deopt"() ]
24 call void (...) @consume(i64 addrspace(1)* %obj2)
25 call void (...) @consume(i64 addrspace(1)* %obj)
29 define void @test7() gc "statepoint-example" {
31 ; CHECK-NOT: gc.statepoint
32 ; Need to delete unreachable gc.statepoint invoke - tested seperately given
33 ; a correct implementation could only remove the instructions, not the block
36 unreached: ; preds = %unreached
37 %obj = phi i64 addrspace(1)* [ null, %unreached ]
38 call void @foo() [ "deopt"() ]
39 call void (...) @consume(i64 addrspace(1)* %obj)
43 define void @test8() gc "statepoint-example" personality i32 ()* undef {
45 ; CHECK-NOT: gc.statepoint
46 ; Bound the last check-not
49 unreached: ; No predecessors!
50 invoke void @foo() [ "deopt"() ]
52 to label %normal_return unwind label %exceptional_return
54 normal_return: ; preds = %unreached
57 exceptional_return: ; preds = %unreached
58 %landing_pad4 = landingpad { i8*, i32 }