optc-save-gen.awk: Set var_opt_hash for initial optimizations and set current index...
authorIan Lance Taylor <iant@golang.org>
Thu, 14 Feb 2019 00:25:40 +0000 (00:25 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 14 Feb 2019 00:25:40 +0000 (00:25 +0000)
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
gcc/optc-save-gen.awk
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/func-attr-1.c [new file with mode: 0644]

index e17956d41417bf5ef01e66178898d9f54d70fc61..76720493dd6137caeeefd45ae721a73e26eadf69 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-13  Ian Lance Taylor  <iant@golang.org>
+
+       * optc-save-gen.awk: Set var_opt_hash for initial optimizations
+       and set current index for other optimizations.
+
 2019-02-13  Uroš Bizjak  <ubizjak@gmail.com>
 
        * config/i386/sse.md (vec_set<VI4F_256_512:mode>_0): Use
index 1285a9f5dfa33557122f60ed74af48e616f979b3..72ebc448ccceb08fe05b8b556fc5d9b1a0a6891a 100644 (file)
@@ -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 "";
index d2d1f28b22e030e8a0b7058d572814e1c07566bd..67059b0c2c08cb756aa0e03ad444324c7e9a9083 100644 (file)
@@ -1,3 +1,7 @@
+2019-02-13  Ian Lance Taylor  <iant@golang.org>
+
+       * gcc.dg/func-attr-1.c: New test.
+
 2019-02-13  Uroš Bizjak  <ubizjak@gmail.com>
 
        * 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 (file)
index 0000000..8d1a3bd
--- /dev/null
@@ -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" } } */