-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lld][MachO] Allow separate --irpgo-profile flag #121354
Conversation
@llvm/pr-subscribers-lld Author: Ellis Hoag (ellishg) ChangesAllow the separate lld flag Full diff: https://github.com/llvm/llvm-project/pull/121354.diff 4 Files Affected:
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 7550b0b9fa531b..31630ba7d69de2 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -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)) {
diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 1d7f1d806cc7f9..4b1e9e4391070d 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -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]">,
diff --git a/lld/test/MachO/bp-section-orderer-errs.s b/lld/test/MachO/bp-section-orderer-errs.s
index 8d19e01c716ea4..abeb25122a929e 100644
--- a/lld/test/MachO/bp-section-orderer-errs.s
+++ b/lld/test/MachO/bp-section-orderer-errs.s
@@ -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
\ No newline at end of file
+# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile
diff --git a/lld/test/MachO/bp-section-orderer.s b/lld/test/MachO/bp-section-orderer.s
index e5d0e7137b30d3..2eaff04bdc0470 100644
--- a/lld/test/MachO/bp-section-orderer.s
+++ b/lld/test/MachO/bp-section-orderer.s
@@ -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
|
@llvm/pr-subscribers-lld-macho Author: Ellis Hoag (ellishg) ChangesAllow the separate lld flag Full diff: https://github.com/llvm/llvm-project/pull/121354.diff 4 Files Affected:
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 7550b0b9fa531b..31630ba7d69de2 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -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)) {
diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 1d7f1d806cc7f9..4b1e9e4391070d 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -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]">,
diff --git a/lld/test/MachO/bp-section-orderer-errs.s b/lld/test/MachO/bp-section-orderer-errs.s
index 8d19e01c716ea4..abeb25122a929e 100644
--- a/lld/test/MachO/bp-section-orderer-errs.s
+++ b/lld/test/MachO/bp-section-orderer-errs.s
@@ -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
\ No newline at end of file
+# STARTUP-COMPRESSION: --bp-startup-sort=function must be used with --irpgo-profile
diff --git a/lld/test/MachO/bp-section-orderer.s b/lld/test/MachO/bp-section-orderer.s
index e5d0e7137b30d3..2eaff04bdc0470 100644
--- a/lld/test/MachO/bp-section-orderer.s
+++ b/lld/test/MachO/bp-section-orderer.s
@@ -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
|
CC @Colibrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM. Sorry.I should have added this in my previous PR. |
Allow the separate lld flag
--irpgo-profile <profile>
(without the=
) in MachO. This flag was added in #118594.