1; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s 2 3; Test to make sure we destroy LCSSA's single entry phi nodes before 4; running liveness 5 6declare void @consume(...) "gc-leaf-function" 7 8define void @test6(ptr addrspace(1) %obj) gc "statepoint-example" { 9; CHECK-LABEL: @test6 10entry: 11 br label %next 12 13next: ; preds = %entry 14; CHECK-LABEL: next: 15; CHECK-NEXT: gc.statepoint 16; CHECK-NEXT: gc.relocate 17; CHECK-NEXT: @consume(ptr addrspace(1) %obj.relocated) 18; CHECK-NEXT: @consume(ptr addrspace(1) %obj.relocated) 19; Need to delete unreachable gc.statepoint call 20 %obj2 = phi ptr addrspace(1) [ %obj, %entry ] 21 call void @foo() [ "deopt"() ] 22 call void (...) @consume(ptr addrspace(1) %obj2) 23 call void (...) @consume(ptr addrspace(1) %obj) 24 ret void 25} 26 27define void @test7() gc "statepoint-example" { 28; CHECK-LABEL: test7 29; CHECK-NOT: gc.statepoint 30; Need to delete unreachable gc.statepoint invoke - tested separately given 31; a correct implementation could only remove the instructions, not the block 32 ret void 33 34unreached: ; preds = %unreached 35 %obj = phi ptr addrspace(1) [ null, %unreached ] 36 call void @foo() [ "deopt"() ] 37 call void (...) @consume(ptr addrspace(1) %obj) 38 br label %unreached 39} 40 41define void @test8() gc "statepoint-example" personality ptr undef { 42; CHECK-LABEL: test8 43; CHECK-NOT: gc.statepoint 44; Bound the last check-not 45 ret void 46 47unreached: ; No predecessors! 48 invoke void @foo() [ "deopt"() ] 49; CHECK-LABEL: @foo 50 to label %normal_return unwind label %exceptional_return 51 52normal_return: ; preds = %unreached 53 ret void 54 55exceptional_return: ; preds = %unreached 56 %landing_pad4 = landingpad { ptr, i32 } 57 cleanup 58 ret void 59} 60 61declare void @foo() 62