12071f7f2SNikita Popov; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2cee313d2SEric Christopher; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s
3cee313d2SEric Christopher; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s
4cee313d2SEric Christopher
5cee313d2SEric Christopherdeclare void @f()
6cee313d2SEric Christopherdeclare i32 @personality_function()
7cee313d2SEric Christopher
8cee313d2SEric Christopherdefine void @test_id() gc "statepoint-example" personality i32 ()* @personality_function {
9cee313d2SEric Christopher; CHECK-LABEL: @test_id(
102071f7f2SNikita Popov; CHECK-NEXT:  entry:
11*c680eeabSNikita Popov; CHECK-NEXT:    [[STATEPOINT_TOKEN:%.*]] = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 100, i32 0, void ()* elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0)
122071f7f2SNikita Popov; CHECK-NEXT:    to label [[NORMAL_RETURN:%.*]] unwind label [[EXCEPTIONAL_RETURN:%.*]]
132071f7f2SNikita Popov; CHECK:       normal_return:
142071f7f2SNikita Popov; CHECK-NEXT:    ret void
152071f7f2SNikita Popov; CHECK:       exceptional_return:
162071f7f2SNikita Popov; CHECK-NEXT:    [[LANDING_PAD4:%.*]] = landingpad { i8*, i32 }
172071f7f2SNikita Popov; CHECK-NEXT:    cleanup
182071f7f2SNikita Popov; CHECK-NEXT:    ret void
192071f7f2SNikita Popov;
20cee313d2SEric Christopherentry:
21cee313d2SEric Christopher  invoke void @f()  "statepoint-id"="100" to label %normal_return unwind label %exceptional_return
22cee313d2SEric Christopher
23cee313d2SEric Christophernormal_return:
24cee313d2SEric Christopher  ret void
25cee313d2SEric Christopher
26cee313d2SEric Christopherexceptional_return:
27cee313d2SEric Christopher  %landing_pad4 = landingpad {i8*, i32} cleanup
28cee313d2SEric Christopher  ret void
29cee313d2SEric Christopher}
30cee313d2SEric Christopher
31cee313d2SEric Christopherdefine void @test_num_patch_bytes() gc "statepoint-example" personality i32 ()* @personality_function {
32cee313d2SEric Christopher; CHECK-LABEL: @test_num_patch_bytes(
332071f7f2SNikita Popov; CHECK-NEXT:  entry:
34*c680eeabSNikita Popov; CHECK-NEXT:    [[STATEPOINT_TOKEN:%.*]] = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 99, void ()* elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0)
352071f7f2SNikita Popov; CHECK-NEXT:    to label [[NORMAL_RETURN:%.*]] unwind label [[EXCEPTIONAL_RETURN:%.*]]
362071f7f2SNikita Popov; CHECK:       normal_return:
372071f7f2SNikita Popov; CHECK-NEXT:    ret void
382071f7f2SNikita Popov; CHECK:       exceptional_return:
392071f7f2SNikita Popov; CHECK-NEXT:    [[LANDING_PAD4:%.*]] = landingpad { i8*, i32 }
402071f7f2SNikita Popov; CHECK-NEXT:    cleanup
412071f7f2SNikita Popov; CHECK-NEXT:    ret void
422071f7f2SNikita Popov;
43cee313d2SEric Christopherentry:
44cee313d2SEric Christopher  invoke void @f()  "statepoint-num-patch-bytes"="99" to label %normal_return unwind label %exceptional_return
45cee313d2SEric Christopher
46cee313d2SEric Christophernormal_return:
47cee313d2SEric Christopher  ret void
48cee313d2SEric Christopher
49cee313d2SEric Christopherexceptional_return:
50cee313d2SEric Christopher  %landing_pad4 = landingpad {i8*, i32} cleanup
51cee313d2SEric Christopher  ret void
52cee313d2SEric Christopher}
53cee313d2SEric Christopher
54cee313d2SEric Christopherdeclare void @do_safepoint()
55cee313d2SEric Christopherdefine void @gc.safepoint_poll() {
562071f7f2SNikita Popov; CHECK-LABEL: @gc.safepoint_poll(
572071f7f2SNikita Popov; CHECK-NEXT:  entry:
582071f7f2SNikita Popov; CHECK-NEXT:    call void @do_safepoint()
592071f7f2SNikita Popov; CHECK-NEXT:    ret void
602071f7f2SNikita Popov;
61cee313d2SEric Christopherentry:
62cee313d2SEric Christopher  call void @do_safepoint()
63cee313d2SEric Christopher  ret void
64cee313d2SEric Christopher}
65cee313d2SEric Christopher
66cee313d2SEric Christopher; CHECK-NOT: statepoint-id
67cee313d2SEric Christopher; CHECK-NOT: statepoint-num-patch_bytes
68