From 471f9e24a61aea7284a3f67ed7cd861e0c6805e3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 14 Feb 2019 00:25:40 +0000 Subject: [PATCH] optc-save-gen.awk: Set var_opt_hash for initial optimizations and set current index for other... gcc/: * optc-save-gen.awk: Set var_opt_hash for initial optimizations and set current index for other optimizations. gcc/testsuite/: * gcc.dg/func-attr-1.c: New test. From-SVN: r268860 --- gcc/ChangeLog | 5 +++++ gcc/optc-save-gen.awk | 6 +++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/func-attr-1.c | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/func-attr-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e17956d4141..76720493dd6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-02-13 Ian Lance Taylor + + * optc-save-gen.awk: Set var_opt_hash for initial optimizations + and set current index for other optimizations. + 2019-02-13 Uroš Bizjak * config/i386/sse.md (vec_set_0): Use diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 1285a9f5dfa..72ebc448ccc 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -770,8 +770,11 @@ print "}"; n_opt_val = 3; var_opt_val[0] = "x_optimize" var_opt_val_type[0] = "char " +var_opt_hash[0] = 1; var_opt_val[1] = "x_optimize_size" +var_opt_hash[1] = 1; var_opt_val[2] = "x_optimize_debug" +var_opt_hash[2] = 1; var_opt_val_type[1] = "char " var_opt_val_type[2] = "char " for (i = 0; i < n_opts; i++) { @@ -787,8 +790,9 @@ for (i = 0; i < n_opts; i++) { otype = var_type_struct(flags[i]) var_opt_val_type[n_opt_val] = otype; - var_opt_val[n_opt_val++] = "x_" name; + var_opt_val[n_opt_val] = "x_" name; var_opt_hash[n_opt_val] = flag_set_p("Optimization", flags[i]); + n_opt_val++; } } print ""; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d2d1f28b22e..67059b0c2c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-02-13 Ian Lance Taylor + + * gcc.dg/func-attr-1.c: New test. + 2019-02-13 Uroš Bizjak * gcc.target/i386/sse2-init-v2di-2.c (dg-final): Update scan string. diff --git a/gcc/testsuite/gcc.dg/func-attr-1.c b/gcc/testsuite/gcc.dg/func-attr-1.c new file mode 100644 index 00000000000..8d1a3bd7243 --- /dev/null +++ b/gcc/testsuite/gcc.dg/func-attr-1.c @@ -0,0 +1,23 @@ +/* Test that setting -Os in a function attribute works. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-rtl-bbro" } */ + +extern void f1 (); +extern int f2 (); + +__attribute__ ((__optimize__ ("O2"))) +void +f3() +{ +} + +__attribute__ ((__optimize__ ("-Os", "-falign-functions", "-falign-jumps", "-falign-labels", "-falign-loops", "-fno-inline-functions", "-foptimize-strlen"))) +int +f4 () { + if (f2 () == 0) { + f1 (); + } + return 0; +} + +/* { dg-final { scan-rtl-dump-not "Duplicated bb" "bbro" } } */ -- 2.30.2