[llvm] [BOLT][AArch64] Refuse to run IndirectCallPromotion pass (PR #194363)
Amina Chabane via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 06:22:56 PDT 2026
https://github.com/Amichaxx updated https://github.com/llvm/llvm-project/pull/194363
>From 68dd5efe31377b2fb8273f8968a36bc23a59fd63 Mon Sep 17 00:00:00 2001
From: Amichaxx <amina.chabane at arm.com>
Date: Mon, 27 Apr 2026 11:29:09 +0000
Subject: [PATCH 1/2] [BOLT][AArch64] Refuse to run IndirectCallPromotion pass
`--icp=<value>`/`--indirect-call-promotion=<value>` results in an
`UNIMPLEMENTED` crash when invoked as it is unimplemented in AArch64.
- Guard IndirectCallPromotion for non-X86
- Update unsupported-passes.test with expected error
---
bolt/lib/Passes/IndirectCallPromotion.cpp | 5 +++++
bolt/test/AArch64/unsupported-passes.test | 2 ++
2 files changed, 7 insertions(+)
diff --git a/bolt/lib/Passes/IndirectCallPromotion.cpp b/bolt/lib/Passes/IndirectCallPromotion.cpp
index 6e5d041468abd..54fd31e37a313 100644
--- a/bolt/lib/Passes/IndirectCallPromotion.cpp
+++ b/bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -1142,6 +1142,11 @@ Error IndirectCallPromotion::runOnFunctions(BinaryContext &BC) {
if (opts::ICP == ICP_NONE)
return Error::success();
+ if (!BC.isX86()) {
+ BC.errs() << "BOLT-ERROR: " << getName() << " is supported only on X86\n";
+ exit(1);
+ }
+
auto &BFs = BC.getBinaryFunctions();
const bool OptimizeCalls = (opts::ICP == ICP_CALLS || opts::ICP == ICP_ALL);
diff --git a/bolt/test/AArch64/unsupported-passes.test b/bolt/test/AArch64/unsupported-passes.test
index 1987ae9407208..58dcb89e6596f 100644
--- a/bolt/test/AArch64/unsupported-passes.test
+++ b/bolt/test/AArch64/unsupported-passes.test
@@ -6,10 +6,12 @@ RUN: %clang %cflags %p/../Inputs/hello.c -o %t -Wl,-q,-z,undefs
RUN: not llvm-bolt %t -o %t.bolt --frame-opt=all 2>&1 | FileCheck %s --check-prefix=CHECK-FRAME-OPT
RUN: not llvm-bolt %t -o %t.bolt --three-way-branch 2>&1 | FileCheck %s --check-prefix=CHECK-THREE-WAY
RUN: not llvm-bolt %t -o %t.bolt --jt-footprint-reduction 2>&1 | FileCheck %s --check-prefix=CHECK-JT-FOOTPRINT-REDUCTION
+RUN: not llvm-bolt %t -o %t.bolt --indirect-call-promotion=all 2>&1 | FileCheck %s --check-prefix=CHECK-INDIRECT-CALL-PROMOTION
CHECK-FRAME-OPT: BOLT-ERROR: frame-optimizer is supported only on X86
CHECK-THREE-WAY: BOLT-ERROR: three way branch is supported only on X86
CHECK-JT-FOOTPRINT-REDUCTION: BOLT-ERROR: jt-footprint-reduction is supported only on X86
+CHECK-INDIRECT-CALL-PROMOTION: BOLT-ERROR: indirect-call-promotion is supported only on X86
// Passes specific to X86 arch
RUN: not llvm-bolt %t -o %t.bolt --cmov-conversion 2>&1 | FileCheck %s --check-prefix=CHECK-CMOV-CONV
>From 83d998c92c31b53c2469925347ba940c82d34da9 Mon Sep 17 00:00:00 2001
From: Amichaxx <amina.chabane at arm.com>
Date: Mon, 27 Apr 2026 13:22:39 +0000
Subject: [PATCH 2/2] Update assume-abi.test to take x86 only.
---
bolt/test/assume-abi.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/test/assume-abi.test b/bolt/test/assume-abi.test
index 688ab011441d3..5c04aa2b58a3f 100644
--- a/bolt/test/assume-abi.test
+++ b/bolt/test/assume-abi.test
@@ -1,7 +1,7 @@
# Validate the usage of the `--assume-abi` option in conjunction with
# options related to the RegAnalysis Pass.
-REQUIRES: system-linux
+REQUIRES: system-linux, target-x86_64
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
RUN: llvm-bolt %t -o %t.bolt --assume-abi --indirect-call-promotion=all
More information about the llvm-commits
mailing list