Skip to content

Commit

Permalink
[clang] Add clang support for Machine Function Splitting on AArch64
Browse files Browse the repository at this point in the history
On x86 targets, -fsplit-machine-functions enables splitting of machine
functions using profile information. This patch rolls out the flag for
AArch64 targets.

Depends on D158647

Differential Revision: https://reviews.llvm.org/D157157
  • Loading branch information
dhoekwater committed Sep 6, 2023
1 parent 25fd5e6 commit 776e3b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5878,8 +5878,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_fsplit_machine_functions,
options::OPT_fno_split_machine_functions)) {
if (!A->getOption().matches(options::OPT_fno_split_machine_functions)) {
// This codegen pass is only available on x86-elf targets.
if (Triple.isX86() && Triple.isOSBinFormatELF())
// This codegen pass is only available on x86 and AArch64 ELF targets.
if ((Triple.isX86() || Triple.isAArch64()) && Triple.isOSBinFormatELF())
A->render(Args, CmdArgs);
else
D.Diag(diag::err_drv_unsupported_opt_for_target)
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/fsplit-machine-functions.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang -### --target=x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefixes=CHECK,LTO-NEG
// RUN: %clang -### --target=aarch64 -fprofile-use=default.profdata -fsplit-machine-functions %s 2>&1 | FileCheck %s --check-prefixes=CHECK,LTO-NEG
// RUN: %clang -### --target=x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c 2>&1 | FileCheck -check-prefix=NEG %s

// CHECK: "-fsplit-machine-functions"
Expand Down

0 comments on commit 776e3b0

Please sign in to comment.