1 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -aarch64-tbz-offset-bits=4 -aarch64-cbz-offset-bits=3 < %s | FileCheck %s
3 ;; Check that branch relaxation accounts for the size of xray EXIT sleds
4 ;; Note that TAIL_CALL sleds don't exist on AArch64 and don't need a test.
5 define void @exit(i1 zeroext %0) nounwind "function-instrument"="xray-always" {
7 ; CHECK-NEXT: .Lfunc_begin0:
8 ; CHECK-NEXT: // %bb.0:
9 ; CHECK-NEXT: .p2align 2
10 ; CHECK-NEXT: .Lxray_sled_0:
15 ; CHECK-SAME: [[FALLTHROUGH:.LBB[0-9_]+]]
17 ; CHECK-SAME: [[OUT_OF_RANGE:.LBB[0-9_]+]]
18 ; CHECK-NEXT: [[FALLTHROUGH]]:
21 ; CHECK-NEXT: .Lxray_sled_1:
27 ; CHECK-NEXT: [[OUT_OF_RANGE]]:
28 ; CHECK-SAME: // %end2
30 br i1 %0, label %end1, label %end2
41 ;; Check that branch relaxation accounts for the size of xray EVENT sleds
42 define void @customevent(i1 zeroext %0, ptr nocapture noundef readonly %e1, i64 noundef %s1, ptr nocapture noundef readonly %e2, i64 noundef %s2) "function-instrument"="xray-always" {
43 ; CHECK-LABEL: customevent:
44 ; CHECK-NEXT: .Lfunc_begin1:
45 ; CHECK-NEXT: .cfi_startproc
46 ; CHECK-NEXT: // %bb.0:
47 ; CHECK-NEXT: .p2align 2
48 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
50 ; CHECK-SAME: [[FALLTHROUGH_2:.LBB[0-9_]+]]
52 ; CHECK-SAME: [[OUT_OF_RANGE_2:.LBB[0-9_]+]]
53 ; CHECK-NEXT: [[FALLTHROUGH_2]]:
54 ; CHECK-SAME: // %end1
55 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
56 ; CHECK-NEXT: Begin XRay custom event
57 ; CHECK: bl __xray_CustomEvent
58 ; CHECK: End XRay custom event
59 ; CHECK-NEXT: [[OUT_OF_RANGE_2]]:
60 ; CHECK-SAME: // %end2
61 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
62 ; CHECK-NEXT: Begin XRay custom event
63 ; CHECK: bl __xray_CustomEvent
64 ; CHECK: End XRay custom event
68 br i1 %0, label %end1, label %end2
71 call void @llvm.xray.customevent(ptr %e1, i64 %s1)
75 tail call void @llvm.xray.customevent(ptr %e2, i64 %s2)
79 ;; Check that branch relaxation accounts for the size of xray TYPED_EVENT sleds
80 define void @typedevent(i1 zeroext %0, i64 noundef %type, ptr nocapture noundef readonly %event, i64 noundef %size) "function-instrument"="xray-always" {
81 ; CHECK-LABEL: typedevent:
82 ; CHECK-NEXT: .Lfunc_begin2:
83 ; CHECK-NEXT: .cfi_startproc
84 ; CHECK-NEXT: // %bb.0:
85 ; CHECK-NEXT: .p2align 2
86 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
88 ; CHECK-SAME: [[FALLTHROUGH_3:.LBB[0-9_]+]]
90 ; CHECK-SAME: [[OUT_OF_RANGE_3:.LBB[0-9_]+]]
91 ; CHECK-NEXT: [[FALLTHROUGH_3]]:
92 ; CHECK-SAME: // %end1
93 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
94 ; CHECK-NEXT: Begin XRay typed event
95 ; CHECK: bl __xray_TypedEvent
96 ; CHECK: End XRay typed event
97 ; CHECK-NEXT: [[OUT_OF_RANGE_3]]:
98 ; CHECK-SAME: // %end2
99 ; CHECK-NEXT: .Lxray_sled_{{[0-9]+}}:
100 ; CHECK-NEXT: Begin XRay typed event
101 ; CHECK: bl __xray_TypedEvent
102 ; CHECK: End XRay typed event
106 br i1 %0, label %end1, label %end2
109 call void @llvm.xray.typedevent(i64 %type, ptr %event, i64 %size)
113 tail call void @llvm.xray.typedevent(i64 %size, ptr %event, i64 %type)
117 declare void @llvm.xray.customevent(ptr, i64)
118 declare void @llvm.xray.typedevent(i64, ptr, i64)