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