• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2;; RUN: opt -rewrite-statepoints-for-gc -verify -S < %s | FileCheck %s
3;; This test is to verify that RewriteStatepointsForGC correctly relocates values
4;; defined by invoke instruction results.
5
6declare i64* addrspace(1)* @non_gc_call() "gc-leaf-function"
7
8declare void @gc_call()
9
10declare i32* @fake_personality_function()
11
12define i64* addrspace(1)* @test() gc "statepoint-example" personality i32* ()* @fake_personality_function {
13; CHECK-LABEL: @test(
14
15entry:
16  %obj = invoke i64* addrspace(1)* @non_gc_call()
17          to label %normal_dest unwind label %unwind_dest
18
19unwind_dest:                                      ; preds = %entry
20  %lpad = landingpad { i8*, i32 }
21          cleanup
22  resume { i8*, i32 } undef
23
24normal_dest:                                      ; preds = %entry
25; CHECK: normal_dest:
26; CHECK-NEXT: gc.statepoint
27; CHECK-NEXT: %obj.relocated = call coldcc i8 addrspace(1)*
28; CHECK-NEXT: bitcast
29
30  call void @gc_call() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
31  ret i64* addrspace(1)* %obj
32}
33