Skip to content

Commit 6ebb890

Browse files
[BOLT][AArch64] Refuse to run FrameOptimizer pass (#152309)
FrameOptimizer pass runs by default on all targets, however, it defaults to --frame-opt=none. This patch prevents the pass from running on non-x86 targets when any other value (hot, full) is specified.
1 parent 18e4f77 commit 6ebb890

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

bolt/lib/Passes/FrameOptimizer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ Error FrameOptimizerPass::runOnFunctions(BinaryContext &BC) {
224224
if (opts::FrameOptimization == FOP_NONE)
225225
return Error::success();
226226

227+
if (!BC.isX86()) {
228+
BC.errs() << "BOLT-ERROR: " << getName() << " is supported only on X86\n";
229+
exit(1);
230+
}
231+
227232
std::unique_ptr<BinaryFunctionCallGraph> CG;
228233
std::unique_ptr<FrameAnalysis> FA;
229234
std::unique_ptr<RegAnalysis> RA;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Checks that non-fully supported passes on AArch64 are handled appropriately.
2+
3+
// REQUIRES: system-linux,asserts,target=aarch64{{.*}}
4+
5+
RUN: %clang %cflags %p/../Inputs/hello.c -o %t -Wl,-q
6+
RUN: not llvm-bolt %t -o %t.bolt --frame-opt=all 2>&1 | FileCheck %s
7+
8+
CHECK: BOLT-ERROR: frame-optimizer is supported only on X86

0 commit comments

Comments
 (0)