[llvm] [BOLT][AArch64][NFC] Add test for conditional tail calls. (PR #201139)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 2 07:54:14 PDT 2026
https://github.com/labrinea created https://github.com/llvm/llvm-project/pull/201139
This used to crash due to failing assertion:
"FKI.TargetOffset == 0 && "0-bit relocation offset expected"
>From 396a083272988dfccad27936e484c5961018e32a Mon Sep 17 00:00:00 2001
From: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
Date: Tue, 2 Jun 2026 15:40:10 +0100
Subject: [PATCH] [BOLT][AArch64][NFC] Add test for conditional tail calls.
This used to crash due to failing assertion:
"FKI.TargetOffset == 0 && "0-bit relocation offset expected"
---
bolt/test/AArch64/conditional-tailcall.s | 49 ++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 bolt/test/AArch64/conditional-tailcall.s
diff --git a/bolt/test/AArch64/conditional-tailcall.s b/bolt/test/AArch64/conditional-tailcall.s
new file mode 100644
index 0000000000000..f05ec4b0610cd
--- /dev/null
+++ b/bolt/test/AArch64/conditional-tailcall.s
@@ -0,0 +1,49 @@
+# Bolt can handle conditional tail calls.
+
+# RUN: %clang %cflags -Wl,-q %s -o %t
+# RUN: llvm-bolt %t -o %t.bolt --skip-funcs foo
+# RUN: llvm-objdump -d %t.bolt | FileCheck %s
+
+ .text
+ .globl foo
+ .type foo, %function
+foo:
+
+test_cbz:
+ cbz xzr, bar
+test_cbnz:
+ cbnz xzr, bar
+test_tbz:
+ tbz xzr, #0, bar
+test_tbnz:
+ tbnz xzr, #0, bar
+test_beq:
+ cmp wzr, wzr
+ b.eq bar
+test_bne:
+ cmp wzr, wzr
+ b.ne bar
+
+ .globl bar
+ .type bar, %function
+bar:
+ ret xzr
+
+# CHECK: Disassembly of section .bolt.org.text:
+#
+# CHECK: <test_cbz>:
+# CHECK-NEXT: {{.*}} cbz xzr, 0x[[ADDR:[0-9a-f]+]] <bar>
+# CHECK: <test_cbnz>:
+# CHECK-NEXT: {{.*}} cbnz xzr, 0x[[ADDR]] <bar>
+# CHECK: <test_tbz>:
+# CHECK-NEXT: {{.*}} tbz wzr, #0x0, 0x[[ADDR]] <bar>
+# CHECK: <test_tbnz>:
+# CHECK-NEXT: {{.*}} tbnz wzr, #0x0, 0x[[ADDR]] <bar>
+# CHECK: <test_beq>:
+# CHECK-NEXT: {{.*}} cmp wzr, wzr
+# CHECK-NEXT: {{.*}} b.eq 0x[[ADDR]] <bar>
+# CHECK: <test_bne>:
+# CHECK-NEXT: {{.*}} cmp wzr, wzr
+# CHECK-NEXT: {{.*}} b.ne 0x[[ADDR]] <bar>
+# CHECK: <bar>:
+# CHECK-NEXT: [[ADDR]]: {{.*}} ret xzr
More information about the llvm-commits
mailing list