1 ; RUN: opt -rewrite-statepoints-for-gc -rs4gc-use-deopt-bundles -S < %s | FileCheck %s
3 ; A null test of a single value
5 define i1 @test(i8 addrspace(1)* %p, i1 %rare) gc "statepoint-example" {
8 %cond = icmp eq i8 addrspace(1)* %p, null
9 br i1 %rare, label %safepoint, label %continue, !prof !0
11 safepoint: ; preds = %entry
12 call void @safepoint() [ "deopt"() ]
15 continue: ; preds = %safepoint, %entry
16 ; CHECK-LABEL: continue:
18 ; CHECK-DAG: [ %p.relocated, %safepoint ]
19 ; CHECK-DAG: [ %p, %entry ]
22 ; Comparing two pointers
23 br i1 %cond, label %taken, label %untaken
25 taken: ; preds = %continue
28 untaken: ; preds = %continue
32 define i1 @test2(i8 addrspace(1)* %p, i8 addrspace(1)* %q, i1 %rare) gc "statepoint-example" {
35 %cond = icmp eq i8 addrspace(1)* %p, %q
36 br i1 %rare, label %safepoint, label %continue, !prof !0
38 safepoint: ; preds = %entry
39 call void @safepoint() [ "deopt"() ]
42 continue: ; preds = %safepoint, %entry
43 ; CHECK-LABEL: continue:
45 ; CHECK-DAG: [ %q.relocated, %safepoint ]
46 ; CHECK-DAG: [ %q, %entry ]
48 ; CHECK-DAG: [ %p.relocated, %safepoint ]
49 ; CHECK-DAG: [ %p, %entry ]
52 ; Sanity check that nothing bad happens if already last instruction
54 br i1 %cond, label %taken, label %untaken
56 taken: ; preds = %continue
59 untaken: ; preds = %continue
63 define i1 @test3(i8 addrspace(1)* %p, i8 addrspace(1)* %q, i1 %rare) gc "statepoint-example" {
65 ; CHECK: gc.statepoint
69 call void @safepoint() [ "deopt"() ]
70 %cond = icmp eq i8 addrspace(1)* %p, %q
71 br i1 %cond, label %taken, label %untaken
73 taken: ; preds = %entry
76 untaken: ; preds = %entry
80 declare void @safepoint()
81 !0 = !{!"branch_weights", i32 1, i32 10000}