[llvm] [BOLT][AArch64] Add tests for unsupported conditional tailcalls (PR #139565)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 08:04:46 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Paschalis Mpeis (paschalis-mpeis)

<details>
<summary>Changes</summary>

Tests cover: cbz, cbnz, tbz, tbnz, b.eq, and b.ne

---
Full diff: https://github.com/llvm/llvm-project/pull/139565.diff


1 Files Affected:

- (added) bolt/test/AArch64/conditional-tailcall.s (+93) 


``````````diff
diff --git a/bolt/test/AArch64/conditional-tailcall.s b/bolt/test/AArch64/conditional-tailcall.s
new file mode 100644
index 0000000000000..1e0a133173381
--- /dev/null
+++ b/bolt/test/AArch64/conditional-tailcall.s
@@ -0,0 +1,93 @@
+# Bolt cannot handle conditional tail calls.
+
+# Example with CBZ:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym CBZ=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-CBZ
+
+# Example with CBNZ:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym CBNZ=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-CBNZ
+
+# Example with TBZ:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym TBZ=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-TBZ
+
+# Example with TBNZ:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym TBNZ=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-TBNZ
+
+# Example with B.EQ:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym BEQ=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-BEQ
+
+# Example with B.NE:
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \
+# RUN: --defsym BNE=1
+# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
+# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-BNE
+
+# CHECK-CBZ:  FKI.TargetOffset == 0 && "0-bit relocation offset expected
+# CHECK-CBNZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected
+# CHECK-TBZ:  FKI.TargetOffset == 0 && "0-bit relocation offset expected
+# CHECK-TBNZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected
+# CHECK-BEQ:  FKI.TargetOffset == 0 && "0-bit relocation offset expected
+# CHECK-BNE:  FKI.TargetOffset == 0 && "0-bit relocation offset expected
+
+  .text
+  .globl foo
+  .type foo, %function
+foo:
+  .cfi_startproc
+
+.ifdef CBZ
+  cbz xzr, bar
+.endif
+
+.ifdef CBNZ
+  cbnz xzr, bar
+.endif
+
+.ifdef TBZ
+  tbz xzr, #0, bar
+.endif
+
+.ifdef TBNZ
+  tbnz xzr, #0, bar
+.endif
+
+.ifdef BEQ
+  cmp wzr, wzr
+  b.eq bar
+.endif
+
+.ifdef BNE
+  cmp wzr, wzr
+  b.ne bar
+.endif
+
+  .cfi_endproc
+.size foo, .-foo
+
+  .globl bar
+  .type bar, %function
+bar:
+  .cfi_startproc
+  ret  xzr
+  .cfi_endproc
+.size bar, .-bar

``````````

</details>


https://github.com/llvm/llvm-project/pull/139565


More information about the llvm-commits mailing list