Skip to content

Commit 40e734e

Browse files
authored
[lld][MachO] Allow separate --irpgo-profile flag (#121354)
1 parent ebdb6cf commit 40e734e

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

lld/MachO/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
18421842
args.hasArg(OPT_irpgo_profile_sort_eq))
18431843
warn("--irpgo-profile-sort is deprecated. Please use "
18441844
"--bp-startup-sort=function");
1845-
if (const Arg *arg = args.getLastArg(OPT_irpgo_profile_eq))
1845+
if (const Arg *arg = args.getLastArg(OPT_irpgo_profile))
18461846
config->irpgoProfilePath = arg->getValue();
18471847

18481848
if (const Arg *arg = args.getLastArg(OPT_irpgo_profile_sort)) {

lld/MachO/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ def no_call_graph_profile_sort : Flag<["--"], "no-call-graph-profile-sort">,
126126
def print_symbol_order_eq: Joined<["--"], "print-symbol-order=">,
127127
HelpText<"Print a symbol order specified by --call-graph-profile-sort into the specified file">,
128128
Group<grp_lld>;
129+
def irpgo_profile: Separate<["--"], "irpgo-profile">, Group<grp_lld>;
129130
def irpgo_profile_eq: Joined<["--"], "irpgo-profile=">,
130-
HelpText<"Read the IRPGO profile for use with -bp-startup-sort and other profile-guided optimizations">,
131+
Alias<!cast<Separate>(irpgo_profile)>, MetaVarName<"<profile>">,
132+
HelpText<"Read the IRPGO <profile> for use with -bp-startup-sort and other profile-guided optimizations">,
131133
Group<grp_lld>;
132134
def bp_startup_sort: Joined<["--"], "bp-startup-sort=">,
133135
MetaVarName<"[none,function]">,

lld/test/MachO/bp-section-orderer-errs.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
# RUN: not %lld -o /dev/null --bp-compression-sort-startup-functions 2>&1 | FileCheck %s --check-prefix=STARTUP
1515
# STARTUP: --bp-compression-sort-startup-functions must be used with --bp-startup-sort=function
1616

17+
# 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
1718
# 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
1819
# IRPGO-STARTUP: --bp-startup-sort= is incompatible with --call-graph-profile-sort
1920

2021
# RUN: not %lld -o /dev/null --bp-startup-sort=function 2>&1 | FileCheck %s --check-prefix=STARTUP-COMPRESSION
21-
# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile
22+
# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile

lld/test/MachO/bp-section-orderer.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# 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
88
# 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
99

10-
# 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
10+
# 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
1111
# 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
1212
# STARTUP: Ordered 3 sections using balanced partitioning
1313

0 commit comments

Comments
 (0)