Home | History | Annotate | Download | only in RewriteStatepointsForGC
      1 ; RUN: opt < %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
      2 
      3 ; CHECK: derived %obj_to_consume base %obj_to_consume.base
      4 
      5 declare void @foo()
      6 
      7 declare i64 addrspace(1)* @generate_obj()
      8 
      9 declare void @consume_obj(i64 addrspace(1)*)
     10 
     11 define void @test(i32 %condition) gc "statepoint-example" {
     12 entry:
     13   br label %loop
     14 
     15 loop:                                             ; preds = %merge.split, %entry
     16 ; CHECK: loop:
     17 ; CHECK:  [[TOKEN_0:%[^ ]+]] = call token (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* ()* @generate_obj, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i3
     18 ; CHECK-NEXT:  [[RESULT_0:%[^ ]+]] = call i64 addrspace(1)* @llvm.experimental.gc.result
     19   %0 = call i64 addrspace(1)* @generate_obj() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
     20   switch i32 %condition, label %dest_a [
     21     i32 0, label %dest_b
     22     i32 1, label %dest_c
     23   ]
     24 
     25 dest_a:                                           ; preds = %loop
     26   br label %merge
     27 
     28 dest_b:                                           ; preds = %loop
     29   br label %merge
     30 
     31 dest_c:                                           ; preds = %loop
     32   br label %merge
     33 
     34 merge:                                            ; preds = %dest_c, %dest_b, %dest_a
     35 ; CHECK: merge:
     36 ; CHECK:  %obj_to_consume = phi i64 addrspace(1)* [ [[RESULT_0]], %dest_a ], [ null, %dest_b ], [ null, %dest_c ]
     37   %obj_to_consume = phi i64 addrspace(1)* [ %0, %dest_a ], [ null, %dest_b ], [ null, %dest_c ]
     38   call void @consume_obj(i64 addrspace(1)* %obj_to_consume) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
     39   br label %merge.split
     40 
     41 merge.split:                                      ; preds = %merge
     42   call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
     43   br label %loop
     44 }
     45