Home | History | Annotate | Download | only in deopt-bundles
      1 ; RUN: opt -S -rewrite-statepoints-for-gc -rs4gc-use-deopt-bundles %s | FileCheck %s
      2 
      3 ; constants don't get relocated.
      4 @G = addrspace(1) global i8 5
      5 
      6 declare void @foo()
      7 
      8 define i8 @test() gc "statepoint-example" {
      9 ; CHECK-LABEL: @test
     10 ; CHECK: gc.statepoint
     11 ; CHECK-NEXT: load i8, i8 addrspace(1)* inttoptr (i64 15 to i8 addrspace(1)*)
     12 ; Mostly just here to show reasonable code test can come from.  
     13 entry:
     14   call void @foo() [ "deopt"() ]
     15   %res = load i8, i8 addrspace(1)* inttoptr (i64 15 to i8 addrspace(1)*)
     16   ret i8 %res
     17 }
     18 
     19 define i8 @test2(i8 addrspace(1)* %p) gc "statepoint-example" {
     20 ; CHECK-LABEL: @test2
     21 ; CHECK: gc.statepoint
     22 ; CHECK-NEXT: gc.relocate
     23 ; CHECK-NEXT: icmp
     24 ; Globals don't move and thus don't get relocated
     25 entry:
     26   call void @foo() [ "deopt"() ]
     27   %cmp = icmp eq i8 addrspace(1)* %p, null
     28   br i1 %cmp, label %taken, label %not_taken
     29 
     30 taken:                                            ; preds = %not_taken, %entry
     31   ret i8 0
     32 
     33 not_taken:                                        ; preds = %entry
     34   %cmp2 = icmp ne i8 addrspace(1)* %p, null
     35   br i1 %cmp2, label %taken, label %dead
     36 
     37 dead:                                             ; preds = %not_taken
     38   %addr = getelementptr i8, i8 addrspace(1)* %p, i32 15
     39   %res = load i8, i8 addrspace(1)* %addr
     40   ret i8 %res
     41 }
     42 
     43 define i8 @test3(i1 %always_true) gc "statepoint-example" {
     44 ; CHECK-LABEL: @test3
     45 ; CHECK: gc.statepoint
     46 ; CHECK-NEXT: load i8, i8 addrspace(1)* @G
     47 entry:
     48   call void @foo() [ "deopt"() ]
     49   %res = load i8, i8 addrspace(1)* @G, align 1
     50   ret i8 %res
     51 }
     52