xref: /llvm-project/llvm/test/Transforms/CallSiteSplitting/lpad.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
154c4609fSRoman Lebedev; RUN: opt -S -passes=callsite-splitting < %s | FileCheck %s
2cee313d2SEric Christopher;
3cee313d2SEric Christopher; Make sure that the callsite is not splitted by checking that there's only one
4cee313d2SEric Christopher; call to @callee.
5cee313d2SEric Christopher
6cee313d2SEric Christopher; CHECK-LABEL: @caller
7cee313d2SEric Christopher; CHECK-LABEL: lpad
8cee313d2SEric Christopher; CHECK: call void @callee
9cee313d2SEric Christopher; CHECK-NOT: call void @callee
10cee313d2SEric Christopher
11*055fb779SNikita Popovdeclare void @foo(ptr %p);
12*055fb779SNikita Popovdeclare void @bar(ptr %p);
13cee313d2SEric Christopherdeclare dso_local i32 @__gxx_personality_v0(...)
14cee313d2SEric Christopher
15*055fb779SNikita Popovdefine void @caller(ptr %p) personality ptr @__gxx_personality_v0 {
16cee313d2SEric Christopherentry:
17*055fb779SNikita Popov  %0 = icmp eq ptr %p, null
18cee313d2SEric Christopher  br i1 %0, label %bb1, label %bb2
19cee313d2SEric Christopher
20cee313d2SEric Christopherbb1:
21*055fb779SNikita Popov  invoke void @foo(ptr %p) to label %end1 unwind label %lpad
22cee313d2SEric Christopher
23cee313d2SEric Christopherbb2:
24*055fb779SNikita Popov  invoke void @bar(ptr %p) to label %end2 unwind label %lpad
25cee313d2SEric Christopher
26cee313d2SEric Christopherlpad:
27*055fb779SNikita Popov  %1 = landingpad { ptr, i32 } cleanup
28*055fb779SNikita Popov  call void @callee(ptr %p)
29*055fb779SNikita Popov  resume { ptr, i32 } %1
30cee313d2SEric Christopher
31cee313d2SEric Christopherend1:
32cee313d2SEric Christopher  ret void
33cee313d2SEric Christopher
34cee313d2SEric Christopherend2:
35cee313d2SEric Christopher  ret void
36cee313d2SEric Christopher}
37cee313d2SEric Christopher
38*055fb779SNikita Popovdefine internal void @callee(ptr %p) {
39cee313d2SEric Christopher  ret void
40cee313d2SEric Christopher}
41