Commit 279dc7a3 by Martin Liska Committed by Martin Liska

Add -flto=auto option value.

2019-08-09  Martin Liska  <mliska@suse.cz>

	* doc/invoke.texi: Document the option value.
	* lto-wrapper.c (run_gcc): Set auto_parallel
	only with -flto=auto.
2019-08-09  Martin Liska  <mliska@suse.cz>

	* g++.dg/lto/devirt-19_0.C: Add -flto=auto.

From-SVN: r274232
parent 40077d15
2019-08-09 Martin Liska <mliska@suse.cz> 2019-08-09 Martin Liska <mliska@suse.cz>
* doc/invoke.texi: Document the option value.
* lto-wrapper.c (run_gcc): Set auto_parallel
only with -flto=auto.
2019-08-09 Martin Liska <mliska@suse.cz>
* opts.c (common_handle_option): Error for an invalid argument * opts.c (common_handle_option): Error for an invalid argument
to -flto=. to -flto=.
......
...@@ -10415,8 +10415,7 @@ If you specify the optional @var{n}, the optimization and code ...@@ -10415,8 +10415,7 @@ If you specify the optional @var{n}, the optimization and code
generation done at link time is executed in parallel using @var{n} generation done at link time is executed in parallel using @var{n}
parallel jobs by utilizing an installed @command{make} program. The parallel jobs by utilizing an installed @command{make} program. The
environment variable @env{MAKE} may be used to override the program environment variable @env{MAKE} may be used to override the program
used. The default value for @var{n} is automatically detected based used.
on number of cores.
You can also specify @option{-flto=jobserver} to use GNU make's You can also specify @option{-flto=jobserver} to use GNU make's
job server mode to determine the number of parallel jobs. This job server mode to determine the number of parallel jobs. This
...@@ -10425,6 +10424,10 @@ You must prepend a @samp{+} to the command recipe in the parent Makefile ...@@ -10425,6 +10424,10 @@ You must prepend a @samp{+} to the command recipe in the parent Makefile
for this to work. This option likely only works if @env{MAKE} is for this to work. This option likely only works if @env{MAKE} is
GNU make. GNU make.
Use @option{-flto=auto} to use GNU make's job server, if available,
or otherwise fall back to autodetection of the number of CPU threads
present in your system.
@item -flto-partition=@var{alg} @item -flto-partition=@var{alg}
@opindex flto-partition @opindex flto-partition
Specify the partitioning algorithm used by the link-time optimizer. Specify the partitioning algorithm used by the link-time optimizer.
...@@ -1252,8 +1252,7 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -1252,8 +1252,7 @@ run_gcc (unsigned argc, char *argv[])
char *list_option_full = NULL; char *list_option_full = NULL;
const char *linker_output = NULL; const char *linker_output = NULL;
const char *collect_gcc, *collect_gcc_options; const char *collect_gcc, *collect_gcc_options;
/* Make linking parallel by default. */ int parallel = 0;
int parallel = 1;
int jobserver = 0; int jobserver = 0;
int auto_parallel = 0; int auto_parallel = 0;
bool no_partition = false; bool no_partition = false;
...@@ -1380,6 +1379,11 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -1380,6 +1379,11 @@ run_gcc (unsigned argc, char *argv[])
case OPT_flto_: case OPT_flto_:
if (strcmp (option->arg, "jobserver") == 0) if (strcmp (option->arg, "jobserver") == 0)
jobserver = 1; jobserver = 1;
else if (strcmp (option->arg, "auto") == 0)
{
parallel = 1;
auto_parallel = 1;
}
else else
{ {
parallel = atoi (option->arg); parallel = atoi (option->arg);
...@@ -1423,14 +1427,8 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -1423,14 +1427,8 @@ run_gcc (unsigned argc, char *argv[])
auto_parallel = 0; auto_parallel = 0;
parallel = 0; parallel = 0;
} }
else if (!jobserver && parallel) else if (!jobserver && auto_parallel)
{ jobserver = jobserver_active_p ();
/* If there's no explicit usage of jobserver and
parallel is enabled, then automatically detect
jobserver or number of cores. */
auto_parallel = 1;
jobserver = jobserver_active_p ();
}
if (linker_output) if (linker_output)
{ {
......
...@@ -2825,6 +2825,7 @@ common_handle_option (struct gcc_options *opts, ...@@ -2825,6 +2825,7 @@ common_handle_option (struct gcc_options *opts,
case OPT_flto_: case OPT_flto_:
if (strcmp (arg, "none") != 0 if (strcmp (arg, "none") != 0
&& strcmp (arg, "jobserver") != 0 && strcmp (arg, "jobserver") != 0
&& strcmp (arg, "auto") != 0
&& atoi (arg) == 0) && atoi (arg) == 0)
error_at (loc, error_at (loc,
"unrecognized argument to %<-flto=%> option: %qs", arg); "unrecognized argument to %<-flto=%> option: %qs", arg);
......
2019-08-09 Martin Liska <mliska@suse.cz> 2019-08-09 Martin Liska <mliska@suse.cz>
* g++.dg/lto/devirt-19_0.C: Add -flto=auto.
2019-08-09 Martin Liska <mliska@suse.cz>
* gcc.dg/spellcheck-options-21.c: New test. * gcc.dg/spellcheck-options-21.c: New test.
2019-08-09 Martin Liska <mliska@suse.cz> 2019-08-09 Martin Liska <mliska@suse.cz>
......
/* { dg-lto-do link } */ /* { dg-lto-do link } */
/* { dg-lto-options { "-O2 -fdump-ipa-cp -Wno-return-type -flto -r -nostdlib" } } */ /* { dg-lto-options { "-O2 -fdump-ipa-cp -Wno-return-type -flto -r -nostdlib" } } */
/* { dg-extra-ld-options "-flinker-output=nolto-rel" } */ /* { dg-extra-ld-options "-flinker-output=nolto-rel -flto=auto" } */
#include "../ipa/devirt-19.C" #include "../ipa/devirt-19.C"
/* { dg-final { scan-wpa-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */ /* { dg-final { scan-wpa-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment