xref: /llvm-project/llvm/test/Transforms/SampleProfile/pseudo-probe-eh.ll (revision b8cc3ba409dc850776f37e27613bf74f5a80d66a)
1; REQUIRES: x86_64-linux
2; RUN: opt < %s -passes=pseudo-probe -function-sections -S -o - | FileCheck %s
3
4;; Check the generation of pseudoprobe intrinsic call for non-EH blocks only.
5
6declare i32 @__gxx_personality_v0(...)
7declare i32 @llvm.eh.typeid.for(ptr) nounwind
8declare ptr @__cxa_begin_catch(ptr)
9declare void @__cxa_end_catch()
10declare void @bar()
11
12@_ZTIi = external constant ptr
13
14define void @foo() uwtable ssp personality ptr @__gxx_personality_v0 {
15entry:
16; CHECK: call void @llvm.pseudoprobe
17  invoke void @bar()
18          to label %ret unwind label %lpad
19
20ret:
21; CHECK-NOT: call void @llvm.pseudoprobe
22  ret void
23
24lpad:                                             ; preds = %entry
25; CHECK-NOT: call void @llvm.pseudoprobe
26  %exn = landingpad {ptr, i32}
27            catch ptr @_ZTIi
28  %eh.exc = extractvalue { ptr, i32 } %exn, 0
29  %eh.selector = extractvalue { ptr, i32 } %exn, 1
30  %0 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind
31  %1 = icmp eq i32 %eh.selector, %0
32  br i1 %1, label %catch, label %eh.resume
33
34catch:
35; CHECK-NOT: call void @llvm.pseudoprobe
36  %ignored = call ptr @__cxa_begin_catch(ptr %eh.exc) nounwind
37  call void @__cxa_end_catch() nounwind
38  br label %ret
39
40eh.resume:
41; CHECK-NOT: call void @llvm.pseudoprobe
42  resume { ptr, i32 } %exn
43}
44