aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-06-02 08:44:37 +0200
committerMartin Liska <mliska@suse.cz>2021-10-01 11:09:10 +0200
commit6de9f0c13b27c34336587da19d03200f8cc6bcd5 (patch)
tree3823c11c2c1796289a7516f9a94976ee601b2bb8 /gcc/toplev.c
parent97909f80fde6c4ce2a2fa1e11b325a80c4741b8c (diff)
downloadgcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.zip
gcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.tar.gz
gcc-6de9f0c13b27c34336587da19d03200f8cc6bcd5.tar.bz2
Append target/optimize attr to the current cmdline.
gcc/c-family/ChangeLog: * c-common.c (parse_optimize_options): Combine optimize options with what was provided on the command line. gcc/ChangeLog: * toplev.c (toplev::main): Save decoded optimization options. * toplev.h (save_opt_decoded_options): New. * doc/extend.texi: Be more clear about optimize and target attributes. gcc/testsuite/ChangeLog: * gcc.target/i386/avx512er-vrsqrt28ps-3.c: Disable fast math. * gcc.target/i386/avx512er-vrsqrt28ps-5.c: Likewise. * gcc.target/i386/attr-optimize.c: New test.
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index e1688aa..78bb7e9 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -121,6 +121,9 @@ static bool no_backend;
struct cl_decoded_option *save_decoded_options;
unsigned int save_decoded_options_count;
+/* Vector of saved Optimization decoded command line options. */
+auto_vec<cl_decoded_option> save_opt_decoded_options;
+
/* Used to enable -fvar-tracking, -fweb and -frename-registers according
to optimize in process_options (). */
#define AUTODETECT_VALUE 2
@@ -2334,6 +2337,11 @@ toplev::main (int argc, char **argv)
&save_decoded_options,
&save_decoded_options_count);
+ /* Save Optimization decoded options. */
+ for (unsigned i = 0; i < save_decoded_options_count; ++i)
+ if (cl_options[save_decoded_options[i].opt_index].flags & CL_OPTIMIZATION)
+ save_opt_decoded_options.safe_push (save_decoded_options[i]);
+
/* Perform language-specific options initialization. */
lang_hooks.init_options (save_decoded_options_count, save_decoded_options);