[llvm] [BOLT][AArch64] Refuse to run IndirectCallPromotion pass (PR #194363)

Amina Chabane via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 05:57:28 PDT 2026


https://github.com/Amichaxx created https://github.com/llvm/llvm-project/pull/194363

`--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

>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] [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



More information about the llvm-commits mailing list