1cee313d2SEric Christopher; RUN: opt -rewrite-statepoints-for-gc -S < %s | FileCheck %s 2cee313d2SEric Christopher; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christopher; A null test of a single value 5cee313d2SEric Christopher 6cee313d2SEric Christopherdefine i1 @test(i8 addrspace(1)* %p, i1 %rare) gc "statepoint-example" { 7cee313d2SEric Christopher; CHECK-LABEL: @test 8cee313d2SEric Christopherentry: 9cee313d2SEric Christopher %cond = icmp eq i8 addrspace(1)* %p, null 10cee313d2SEric Christopher br i1 %rare, label %safepoint, label %continue, !prof !0 11cee313d2SEric Christopher 12cee313d2SEric Christophersafepoint: ; preds = %entry 13cee313d2SEric Christopher call void @safepoint() [ "deopt"() ] 14cee313d2SEric Christopher br label %continue 15cee313d2SEric Christopher 16cee313d2SEric Christophercontinue: ; preds = %safepoint, %entry 17cee313d2SEric Christopher; CHECK-LABEL: continue: 18cee313d2SEric Christopher; CHECK: phi 19cee313d2SEric Christopher; CHECK-DAG: [ %p.relocated, %safepoint ] 20cee313d2SEric Christopher; CHECK-DAG: [ %p, %entry ] 21cee313d2SEric Christopher; CHECK: %cond = icmp 22cee313d2SEric Christopher; CHECK: br i1 %cond 23cee313d2SEric Christopher; Comparing two pointers 24cee313d2SEric Christopher br i1 %cond, label %taken, label %untaken 25cee313d2SEric Christopher 26cee313d2SEric Christophertaken: ; preds = %continue 27cee313d2SEric Christopher ret i1 true 28cee313d2SEric Christopher 29cee313d2SEric Christopheruntaken: ; preds = %continue 30cee313d2SEric Christopher ret i1 false 31cee313d2SEric Christopher} 32cee313d2SEric Christopher 33cee313d2SEric Christopherdefine i1 @test2(i8 addrspace(1)* %p, i8 addrspace(1)* %q, i1 %rare) gc "statepoint-example" { 34cee313d2SEric Christopher; CHECK-LABEL: @test2 35cee313d2SEric Christopherentry: 36cee313d2SEric Christopher %cond = icmp eq i8 addrspace(1)* %p, %q 37cee313d2SEric Christopher br i1 %rare, label %safepoint, label %continue, !prof !0 38cee313d2SEric Christopher 39cee313d2SEric Christophersafepoint: ; preds = %entry 40cee313d2SEric Christopher call void @safepoint() [ "deopt"() ] 41cee313d2SEric Christopher br label %continue 42cee313d2SEric Christopher 43cee313d2SEric Christophercontinue: ; preds = %safepoint, %entry 44cee313d2SEric Christopher; CHECK-LABEL: continue: 45cee313d2SEric Christopher; CHECK: phi 46cee313d2SEric Christopher; CHECK-DAG: [ %q.relocated, %safepoint ] 47cee313d2SEric Christopher; CHECK-DAG: [ %q, %entry ] 48cee313d2SEric Christopher; CHECK: phi 49cee313d2SEric Christopher; CHECK-DAG: [ %p.relocated, %safepoint ] 50cee313d2SEric Christopher; CHECK-DAG: [ %p, %entry ] 51cee313d2SEric Christopher; CHECK: %cond = icmp 52cee313d2SEric Christopher; CHECK: br i1 %cond 53*9769e97cSZarko Todorovski; Check that nothing bad happens if already last instruction 54cee313d2SEric Christopher; before terminator 55cee313d2SEric Christopher br i1 %cond, label %taken, label %untaken 56cee313d2SEric Christopher 57cee313d2SEric Christophertaken: ; preds = %continue 58cee313d2SEric Christopher ret i1 true 59cee313d2SEric Christopher 60cee313d2SEric Christopheruntaken: ; preds = %continue 61cee313d2SEric Christopher ret i1 false 62cee313d2SEric Christopher} 63cee313d2SEric Christopher 64cee313d2SEric Christopherdefine i1 @test3(i8 addrspace(1)* %p, i8 addrspace(1)* %q, i1 %rare) gc "statepoint-example" { 65cee313d2SEric Christopher; CHECK-LABEL: @test3 66cee313d2SEric Christopher; CHECK: gc.statepoint 67cee313d2SEric Christopher; CHECK: %cond = icmp 68cee313d2SEric Christopher; CHECK: br i1 %cond 69cee313d2SEric Christopherentry: 70cee313d2SEric Christopher call void @safepoint() [ "deopt"() ] 71cee313d2SEric Christopher %cond = icmp eq i8 addrspace(1)* %p, %q 72cee313d2SEric Christopher br i1 %cond, label %taken, label %untaken 73cee313d2SEric Christopher 74cee313d2SEric Christophertaken: ; preds = %entry 75cee313d2SEric Christopher ret i1 true 76cee313d2SEric Christopher 77cee313d2SEric Christopheruntaken: ; preds = %entry 78cee313d2SEric Christopher ret i1 false 79cee313d2SEric Christopher} 80cee313d2SEric Christopher 81cee313d2SEric Christopherdeclare void @safepoint() 82cee313d2SEric Christopher!0 = !{!"branch_weights", i32 1, i32 10000} 83