1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=rewrite-statepoints-for-gc -S < %s | FileCheck %s
3 ; Check that the "deopt-lowering" function attribute gets transcoded into
4 ; flags on the resulting statepoint
6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-apple-macosx10.11.0"
10 declare void @bar() "deopt-lowering"="live-in"
11 declare void @baz() "deopt-lowering"="live-through"
13 define void @test1() gc "statepoint-example" {
14 ; CHECK-LABEL: @test1(
16 ; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 57) ]
17 ; CHECK-NEXT: [[STATEPOINT_TOKEN1:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @bar, i32 0, i32 2, i32 0, i32 0) [ "deopt"(i32 42) ]
18 ; CHECK-NEXT: [[STATEPOINT_TOKEN2:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @baz, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 13) ]
19 ; CHECK-NEXT: ret void
23 call void @foo() [ "deopt"(i32 57) ]
24 call void @bar() [ "deopt"(i32 42) ]
25 call void @baz() [ "deopt"(i32 13) ]
29 ; add deopt-lowering attribute as part of callsite
30 define void @test2() gc "statepoint-example" {
31 ; CHECK-LABEL: @test2(
33 ; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 2, i32 0, i32 0) #[[ATTR0:[0-9]+]] [ "deopt"(i32 57) ]
34 ; CHECK-NEXT: ret void
38 call void @foo() "deopt-lowering"="live-in" [ "deopt"(i32 57) ]