Home | History | Annotate | Download | only in deopt-bundles
      1 ; RUN: opt -rewrite-statepoints-for-gc -rs4gc-use-deopt-bundles -S < %s | FileCheck %s
      2 
      3 ; Test to make sure we destroy LCSSA's single entry phi nodes before
      4 ; running liveness
      5 
      6 declare void @consume(...) "gc-leaf-function"
      7 
      8 define void @test6(i64 addrspace(1)* %obj) gc "statepoint-example" {
      9 ; CHECK-LABEL: @test6
     10 entry:
     11   br label %next
     12 
     13 next:                                             ; preds = %entry
     14 ; CHECK-LABEL: next:
     15 ; CHECK-NEXT: gc.statepoint
     16 ; CHECK-NEXT: gc.relocate
     17 ; CHECK-NEXT: bitcast
     18 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
     19 ; CHECK-NEXT: @consume(i64 addrspace(1)* %obj.relocated.casted)
     20 ; Need to delete unreachable gc.statepoint call
     21   %obj2 = phi i64 addrspace(1)* [ %obj, %entry ]
     22   call void @foo() [ "deopt"() ]
     23   call void (...) @consume(i64 addrspace(1)* %obj2)
     24   call void (...) @consume(i64 addrspace(1)* %obj)
     25   ret void
     26 }
     27 
     28 define void @test7() gc "statepoint-example" {
     29 ; CHECK-LABEL: test7
     30 ; CHECK-NOT: gc.statepoint
     31 ; Need to delete unreachable gc.statepoint invoke - tested seperately given
     32 ; a correct implementation could only remove the instructions, not the block
     33   ret void
     34 
     35 unreached:                                        ; preds = %unreached
     36   %obj = phi i64 addrspace(1)* [ null, %unreached ]
     37   call void @foo() [ "deopt"() ]
     38   call void (...) @consume(i64 addrspace(1)* %obj)
     39   br label %unreached
     40 }
     41 
     42 define void @test8() gc "statepoint-example" personality i32 ()* undef {
     43 ; CHECK-LABEL: test8
     44 ; CHECK-NOT: gc.statepoint
     45 ; Bound the last check-not
     46   ret void
     47 
     48 unreached:                                        ; No predecessors!
     49   invoke void @foo() [ "deopt"() ]
     50 ; CHECK-LABEL: @foo
     51           to label %normal_return unwind label %exceptional_return
     52 
     53 normal_return:                                    ; preds = %unreached
     54   ret void
     55 
     56 exceptional_return:                               ; preds = %unreached
     57   %landing_pad4 = landingpad { i8*, i32 }
     58           cleanup
     59   ret void
     60 }
     61 
     62 declare void @foo()
     63