xref: /llvm-project/llvm/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll (revision 8979ae42769e529b0f6fce3268492ffb49bd54b9)
1; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
2; Test that statepoint intrinsic is marked with Throwable attribute and it is
3; not optimized into call
4
5declare ptr addrspace(1) @gc_call()
6declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr addrspace(1) ()*, i32, i32, ...)
7declare ptr @fake_personality_function()
8
9define i32 @test() gc "statepoint-example" personality ptr @fake_personality_function {
10; CHECK-LABEL: test
11entry:
12  ; CHECK-LABEL: entry:
13  ; CHECK-NEXT: %sp = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0
14  %sp = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(ptr addrspace(1) ()) @gc_call, i32 0, i32 0, i32 0, i32 0)
15                to label %normal unwind label %exception
16
17exception:
18  %lpad = landingpad { ptr, i32 }
19          cleanup
20  ret i32 0
21
22normal:
23  ret i32 1
24}
25