1 ; RUN: opt -rewrite-statepoints-for-gc -rs4gc-use-deopt-bundles -S < %s | FileCheck %s
3 ; Test to make sure we destroy LCSSA's single entry phi nodes before
6 declare void @consume(...) "gc-leaf-function"
8 define void @test6(i64 addrspace(1)* %obj) gc "statepoint-example" {
13 next: ; preds = %entry
15 ; CHECK-NEXT: gc.statepoint
16 ; CHECK-NEXT: gc.relocate
18 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
19 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
20 ; Need to delete unreachable gc.statepoint call
21 %obj2 = phi i64 addrspace(1)* [ %obj, %entry ]
22 call void @foo() [ "deopt"() ]
23 call void (...) @consume(i64 addrspace(1)* %obj2)
24 call void (...) @consume(i64 addrspace(1)* %obj)
28 define void @test7() gc "statepoint-example" {
30 ; CHECK-NOT: gc.statepoint
31 ; Need to delete unreachable gc.statepoint invoke - tested seperately given
32 ; a correct implementation could only remove the instructions, not the block
35 unreached: ; preds = %unreached
36 %obj = phi i64 addrspace(1)* [ null, %unreached ]
37 call void @foo() [ "deopt"() ]
38 call void (...) @consume(i64 addrspace(1)* %obj)
42 define void @test8() gc "statepoint-example" personality i32 ()* undef {
44 ; CHECK-NOT: gc.statepoint
45 ; Bound the last check-not
48 unreached: ; No predecessors!
49 invoke void @foo() [ "deopt"() ]
51 to label %normal_return unwind label %exceptional_return
53 normal_return: ; preds = %unreached
56 exceptional_return: ; preds = %unreached
57 %landing_pad4 = landingpad { i8*, i32 }