Skip to content

Commit

Permalink
[lld][MachO] Allow separate --irpgo-profile flag (llvm#121354)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellishg authored Dec 31, 2024
1 parent ebdb6cf commit 40e734e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lld/MachO/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
args.hasArg(OPT_irpgo_profile_sort_eq))
warn("--irpgo-profile-sort is deprecated. Please use "
"--bp-startup-sort=function");
if (const Arg *arg = args.getLastArg(OPT_irpgo_profile_eq))
if (const Arg *arg = args.getLastArg(OPT_irpgo_profile))
config->irpgoProfilePath = arg->getValue();

if (const Arg *arg = args.getLastArg(OPT_irpgo_profile_sort)) {
Expand Down
4 changes: 3 additions & 1 deletion lld/MachO/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ def no_call_graph_profile_sort : Flag<["--"], "no-call-graph-profile-sort">,
def print_symbol_order_eq: Joined<["--"], "print-symbol-order=">,
HelpText<"Print a symbol order specified by --call-graph-profile-sort into the specified file">,
Group<grp_lld>;
def irpgo_profile: Separate<["--"], "irpgo-profile">, Group<grp_lld>;
def irpgo_profile_eq: Joined<["--"], "irpgo-profile=">,
HelpText<"Read the IRPGO profile for use with -bp-startup-sort and other profile-guided optimizations">,
Alias<!cast<Separate>(irpgo_profile)>, MetaVarName<"<profile>">,
HelpText<"Read the IRPGO <profile> for use with -bp-startup-sort and other profile-guided optimizations">,
Group<grp_lld>;
def bp_startup_sort: Joined<["--"], "bp-startup-sort=">,
MetaVarName<"[none,function]">,
Expand Down
3 changes: 2 additions & 1 deletion lld/test/MachO/bp-section-orderer-errs.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# RUN: not %lld -o /dev/null --bp-compression-sort-startup-functions 2>&1 | FileCheck %s --check-prefix=STARTUP
# STARTUP: --bp-compression-sort-startup-functions must be used with --bp-startup-sort=function

# RUN: not %lld -o /dev/null --irpgo-profile %s --bp-startup-sort=function --call-graph-profile-sort 2>&1 | FileCheck %s --check-prefix=IRPGO-STARTUP
# RUN: not %lld -o /dev/null --irpgo-profile=%s --bp-startup-sort=function --call-graph-profile-sort 2>&1 | FileCheck %s --check-prefix=IRPGO-STARTUP
# IRPGO-STARTUP: --bp-startup-sort= is incompatible with --call-graph-profile-sort

# RUN: not %lld -o /dev/null --bp-startup-sort=function 2>&1 | FileCheck %s --check-prefix=STARTUP-COMPRESSION
# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile
# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile
2 changes: 1 addition & 1 deletion lld/test/MachO/bp-section-orderer.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile-sort=%t/a.profdata --verbose-bp-section-orderer 2>&1 | FileCheck %s --check-prefix=STARTUP
# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile-sort=%t/a.profdata --verbose-bp-section-orderer --icf=all --compression-sort=none 2>&1 | FileCheck %s --check-prefix=STARTUP

# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile=%t/a.profdata --bp-startup-sort=function --verbose-bp-section-orderer 2>&1 | FileCheck %s --check-prefix=STARTUP
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile %t/a.profdata --bp-startup-sort=function --verbose-bp-section-orderer 2>&1 | FileCheck %s --check-prefix=STARTUP
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile=%t/a.profdata --bp-startup-sort=function --verbose-bp-section-orderer --icf=all --bp-compression-sort=none 2>&1 | FileCheck %s --check-prefix=STARTUP
# STARTUP: Ordered 3 sections using balanced partitioning

Expand Down

0 comments on commit 40e734e

Please sign in to comment.