1 ; RUN: opt < %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
2 ; RUN: opt < %s -passes=rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
5 declare i1 @runtime_value() "gc-leaf-function"
7 declare void @do_safepoint()
9 define void @select_of_phi(i64 addrspace(1)* %base_obj_x, i64 addrspace(1)* %base_obj_y) gc "statepoint-example" {
13 loop: ; preds = %merge, %entry
14 %current_x = phi i64 addrspace(1)* [ %base_obj_x, %entry ], [ %next_x, %merge ]
15 %current_y = phi i64 addrspace(1)* [ %base_obj_y, %entry ], [ %next_y, %merge ]
16 %current = phi i64 addrspace(1)* [ null, %entry ], [ %next, %merge ]
17 %condition = call i1 @runtime_value()
18 %next_x = getelementptr i64, i64 addrspace(1)* %current_x, i32 1
19 %next_y = getelementptr i64, i64 addrspace(1)* %current_y, i32 1
20 br i1 %condition, label %true, label %false
25 false: ; preds = %loop
28 merge: ; preds = %false, %true
29 %next = phi i64 addrspace(1)* [ %next_x, %true ], [ %next_y, %false ]
30 call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
33 ; CHECK: Base Pairs (w/o Relocation):
34 ; CHECK-DAG: derived %next base %next.base
35 ; CHECK-DAG: derived %next_x base %base_obj_x
36 ; CHECK-DAG: derived %next_y base %base_obj_y