xref: /llvm-project/llvm/test/Transforms/RewriteStatepointsForGC/deopt-lowering-attrs.ll (revision 3528e63d89305907b3d6e0f59f7b03b94a12dacc)
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
5
6target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7target triple = "x86_64-apple-macosx10.11.0"
8
9declare void @foo()
10declare void @bar() "deopt-lowering"="live-in"
11declare void @baz() "deopt-lowering"="live-through"
12
13define void @test1() gc "statepoint-example" {
14; CHECK-LABEL: @test1(
15; CHECK-NEXT:  entry:
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
20;
21
22entry:
23  call void @foo() [ "deopt"(i32 57) ]
24  call void @bar() [ "deopt"(i32 42) ]
25  call void @baz() [ "deopt"(i32 13) ]
26  ret void
27}
28
29; add deopt-lowering attribute as part of callsite
30define void @test2() gc "statepoint-example" {
31; CHECK-LABEL: @test2(
32; CHECK-NEXT:  entry:
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
35;
36
37entry:
38  call void @foo()  "deopt-lowering"="live-in"  [ "deopt"(i32 57) ]
39  ret void
40}
41
42