• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6
7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-apple-macosx10.11.0"
9
10declare void @foo()
11declare void @bar() "deopt-lowering"="live-in"
12declare void @baz() "deopt-lowering"="live-through"
13
14define void @test1() gc "statepoint-example" {
15; CHECK-LABEL: @test1(
16; CHECK-NEXT:  entry:
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
21;
22
23entry:
24  call void @foo() [ "deopt"(i32 57) ]
25  call void @bar() [ "deopt"(i32 42) ]
26  call void @baz() [ "deopt"(i32 13) ]
27  ret void
28}
29
30; add deopt-lowering attribute as part of callsite
31define void @test2() gc "statepoint-example" {
32; CHECK-LABEL: @test2(
33; CHECK-NEXT:  entry:
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) #0 [ "deopt"(i32 57) ]
35; CHECK-NEXT:    ret void
36;
37
38entry:
39  call void @foo()  "deopt-lowering"="live-in"  [ "deopt"(i32 57) ]
40  ret void
41}
42
43