Unverified Commit bd7cd403 authored by Amina Chabane's avatar Amina Chabane Committed by GitHub
Browse files

[BOLT][AArch64] Refuse to run CMOVConversion pass (#193998)

`--cmov-conversion` is unsupported in AArch64 as
convertMoveToConditionalMove() is only overriden for X86.

- Add a guard for non-X86
- Update unsupported-passes.test with expected error
parent c12ce421
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -271,6 +271,11 @@ void CMOVConversion::runOnFunction(BinaryFunction &Function) {
}

Error CMOVConversion::runOnFunctions(BinaryContext &BC) {
  if (!BC.isX86()) {
    BC.errs() << "BOLT-ERROR: " << getName() << " is supported only on X86\n";
    exit(1);
  }

  for (auto &It : BC.getBinaryFunctions()) {
    BinaryFunction &Function = It.second;
    if (!shouldOptimize(Function))
+5 −0
Original line number Diff line number Diff line
@@ -10,5 +10,10 @@ RUN: not llvm-bolt %t -o %t.bolt --jt-footprint-reduction 2>&1 | FileCheck %s --
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

// Passes specific to X86 arch
RUN: not llvm-bolt %t -o %t.bolt --cmov-conversion 2>&1 | FileCheck %s --check-prefix=CHECK-CMOV-CONV
CHECK-CMOV-CONV: BOLT-ERROR: CMOV conversion is supported only on X86

RUN: not llvm-bolt %t -o %t.bolt split-functions --split-strategy=cdsplit 2>&1 | FileCheck %s --check-prefix=CHECK-CDSPLIT
CHECK-CDSPLIT: BOLT-ERROR: CDSplit is not supported with LongJmp. Try with '--compact-code-model'