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