re PR middle-end/92046 (Command line options (that are per-functions) are affecting...
authorRichard Biener <rguenther@suse.de>
Tue, 15 Oct 2019 07:28:26 +0000 (07:28 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 15 Oct 2019 07:28:26 +0000 (07:28 +0000)
2019-10-15  Richard Biener  <rguenther@suse.de>

PR middle-end/92046
* common.opt (fallow-store-data-races): New.
* params.def (PARAM_ALLOW_STORE_DATA_RACES): Remove.
* params.h (ALLOW_STORE_DATA_RACES): Likewise.
* doc/invoke.texi (fallow-store-data-races): Document.
(--param allow-store-data-races): Remove docs.
* opts.c (default_options_table): Enable -fallow-store-data-races
at -Ofast.
(default_options_optimization): Do not enable --param
allow-store-data-races at -Ofast.
* tree-if-conv.c (ifcvt_memrefs_wont_trap): Use flag_store_data_races
instead of PARAM_ALLOW_STORE_DATA_RACES.
* tree-ssa-loop-im.c (execute_sm): Likewise.

* c-c++-common/cxxbitfields-3.c: Adjust.
* c-c++-common/cxxbitfields-6.c: Likewise.
* c-c++-common/simulate-thread/bitfields-1.c: Likewise.
* c-c++-common/simulate-thread/bitfields-2.c: Likewise.
* c-c++-common/simulate-thread/bitfields-3.c: Likewise.
* c-c++-common/simulate-thread/bitfields-4.c: Likewise.
* g++.dg/simulate-thread/bitfields-2.C: Likewise.
* g++.dg/simulate-thread/bitfields.C: Likewise.
* gcc.dg/lto/pr52097_0.c: Likewise.
* gcc.dg/simulate-thread/speculative-store-2.c: Likewise.
* gcc.dg/simulate-thread/speculative-store-3.c: Likewise.
* gcc.dg/simulate-thread/speculative-store-4.c: Likewise.
* gcc.dg/simulate-thread/speculative-store.c: Likewise.
* gcc.dg/tree-ssa/20050314-1.c: Likewise.

From-SVN: r276985

23 files changed:
gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/opts.c
gcc/params.def
gcc/params.h
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cxxbitfields-3.c
gcc/testsuite/c-c++-common/cxxbitfields-6.c
gcc/testsuite/c-c++-common/simulate-thread/bitfields-1.c
gcc/testsuite/c-c++-common/simulate-thread/bitfields-2.c
gcc/testsuite/c-c++-common/simulate-thread/bitfields-3.c
gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c
gcc/testsuite/g++.dg/simulate-thread/bitfields-2.C
gcc/testsuite/g++.dg/simulate-thread/bitfields.C
gcc/testsuite/gcc.dg/lto/pr52097_0.c
gcc/testsuite/gcc.dg/simulate-thread/speculative-store-2.c
gcc/testsuite/gcc.dg/simulate-thread/speculative-store-3.c
gcc/testsuite/gcc.dg/simulate-thread/speculative-store-4.c
gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c
gcc/tree-if-conv.c
gcc/tree-ssa-loop-im.c

index 91809ca9c071f6867cb8beb4fcc9020c8d50e628..299bcb1c8a5d24210e7904d7cf0bd85c2c3e89b8 100644 (file)
@@ -1,3 +1,19 @@
+2019-10-15  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/92046
+       * common.opt (fallow-store-data-races): New.
+       * params.def (PARAM_ALLOW_STORE_DATA_RACES): Remove.
+       * params.h (ALLOW_STORE_DATA_RACES): Likewise.
+       * doc/invoke.texi (fallow-store-data-races): Document.
+       (--param allow-store-data-races): Remove docs.
+       * opts.c (default_options_table): Enable -fallow-store-data-races
+       at -Ofast.
+       (default_options_optimization): Do not enable --param
+       allow-store-data-races at -Ofast.
+       * tree-if-conv.c (ifcvt_memrefs_wont_trap): Use flag_store_data_races
+       instead of PARAM_ALLOW_STORE_DATA_RACES.
+       * tree-ssa-loop-im.c (execute_sm): Likewise.
+
 2019-10-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR tree-optimization/92085
index 124e8cf3ebe8aec4379bb980a0de6d4ed4969da6..859c0f9141dd7bbd1651cb95bf70f7de716e6e09 100644 (file)
@@ -993,6 +993,10 @@ Align the start of loops.
 falign-loops=
 Common RejectNegative Joined Var(str_align_loops) Optimization
 
+fallow-store-data-races
+Common Report Var(flag_store_data_races) Optimization
+Allow the compiler to introduce new data races on stores.
+
 fargument-alias
 Common Ignore
 Does nothing. Preserved for backward compatibility.
index 085e8b0b2cac0b6f55d795b18ca4541f924e7c33..47769262b8e7bece23fd9253f428afebc9fcdc39 100644 (file)
@@ -406,6 +406,7 @@ Objective-C and Objective-C++ Dialects}.
 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
+-fallow-store-data-races @gol
 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
 -fauto-inc-dec  -fbranch-probabilities @gol
 -fcaller-saves @gol
@@ -8463,9 +8464,9 @@ designed to reduce code size.
 Disregard strict standards compliance.  @option{-Ofast} enables all
 @option{-O3} optimizations.  It also enables optimizations that are not
 valid for all standard-compliant programs.
-It turns on @option{-ffast-math} and the Fortran-specific
-@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
-specified, and @option{-fno-protect-parens}.
+It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
+and the Fortran-specific @option{-fstack-arrays}, unless
+@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
 
 @item -Og
 @opindex Og
@@ -10227,6 +10228,12 @@ The maximum allowed @var{n} option value is 65536.
 
 Enabled at levels @option{-O2}, @option{-O3}.
 
+@item -fallow-store-data-races
+@opindex fallow-store-data-races
+Allow the compiler to introduce new data races on stores.
+
+Enabled at level @option{-Ofast}.
+
 @item -funit-at-a-time
 @opindex funit-at-a-time
 This option is left for compatibility reasons. @option{-funit-at-a-time}
@@ -12060,10 +12067,6 @@ The maximum number of conditional store pairs that can be sunk.  Set to 0
 if either vectorization (@option{-ftree-vectorize}) or if-conversion
 (@option{-ftree-loop-if-convert}) is disabled.
 
-@item allow-store-data-races
-Allow optimizers to introduce new data races on stores.
-Set to 1 to allow, otherwise to 0.
-
 @item case-values-threshold
 The smallest number of different values for which it is best to use a
 jump-table instead of a tree of conditional branches.  If the value is
index ff95853845e3d241cb3bb929aca04c80ca84f881..10b9f108f8d0618501c1567bb4f8a7f9de2bdb98 100644 (file)
@@ -564,6 +564,7 @@ static const struct default_options default_options_table[] =
 
     /* -Ofast adds optimizations to -O3.  */
     { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },
+    { OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 },
 
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
@@ -671,13 +672,6 @@ default_options_optimization (struct gcc_options *opts,
      opt2 ? 100 : default_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE),
      opts->x_param_values, opts_set->x_param_values);
 
-  /* At -Ofast, allow store motion to introduce potential race conditions.  */
-  maybe_set_param_value
-    (PARAM_ALLOW_STORE_DATA_RACES,
-     opts->x_optimize_fast ? 1
-     : default_param_value (PARAM_ALLOW_STORE_DATA_RACES),
-     opts->x_param_values, opts_set->x_param_values);
-
   if (opts->x_optimize_size)
     /* We want to crossjump as much as possible.  */
     maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
index 4cb48d9ab5baa889392172442823717f9eda7b1c..e4b70bac22a43a9b6098fde1d819f12d3cf9f08b 100644 (file)
@@ -1225,12 +1225,6 @@ DEFPARAM (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SPEED,
          "optimizing for speed.",
          800, 0, 0)
 
-/* Data race flags for C++0x memory model compliance.  */
-DEFPARAM (PARAM_ALLOW_STORE_DATA_RACES,
-         "allow-store-data-races",
-         "Allow new data races on stores to be introduced.",
-         0, 0, 1)
-
 /* Reassociation width to be used by tree reassoc optimization.  */
 DEFPARAM (PARAM_TREE_REASSOC_WIDTH,
          "tree-reassoc-width",
index 26f1236aa65422f66939ef2a4c38958bdc984aee..1aaef6d6a00da79533eb0bba540dd8c731b1eaa8 100644 (file)
@@ -228,8 +228,6 @@ extern void init_param_values (int *params);
   PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
 #define ALLOW_LOAD_DATA_RACES \
   PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES)
-#define ALLOW_STORE_DATA_RACES \
-  PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
 #define ALLOW_PACKED_LOAD_DATA_RACES \
   PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
 #define ALLOW_PACKED_STORE_DATA_RACES \
index ae169070ed52202204c65ee738fd033375f88eba..8ff78713652fdc78e4f87e06e353ea45a566d0cf 100644 (file)
@@ -1,3 +1,21 @@
+2019-10-15  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/92046
+       * c-c++-common/cxxbitfields-3.c: Adjust.
+       * c-c++-common/cxxbitfields-6.c: Likewise.
+       * c-c++-common/simulate-thread/bitfields-1.c: Likewise.
+       * c-c++-common/simulate-thread/bitfields-2.c: Likewise.
+       * c-c++-common/simulate-thread/bitfields-3.c: Likewise.
+       * c-c++-common/simulate-thread/bitfields-4.c: Likewise.
+       * g++.dg/simulate-thread/bitfields-2.C: Likewise.
+       * g++.dg/simulate-thread/bitfields.C: Likewise.
+       * gcc.dg/lto/pr52097_0.c: Likewise.
+       * gcc.dg/simulate-thread/speculative-store-2.c: Likewise.
+       * gcc.dg/simulate-thread/speculative-store-3.c: Likewise.
+       * gcc.dg/simulate-thread/speculative-store-4.c: Likewise.
+       * gcc.dg/simulate-thread/speculative-store.c: Likewise.
+       * gcc.dg/tree-ssa/20050314-1.c: Likewise.
+
 2019-10-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR tree-optimization/92085
index fc423ea8b293dd0c11de1c38508af99e0e04af96..706bf8659ea96449badc61cd674eabd1e2a1a5b2 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O2 --param allow-store-data-races=0" } */
+/* { dg-options "-O2 -fno-allow-store-data-races" } */
 
 /* Make sure we don't narrow down to a QI or HI to store into VAR.J,
    but instead use an SI.  */
index bdd62941b4db0aa91b8b640bd8be5d968108dfe6..273117c0589dc65e243c07499ad114b5e884349f 100644 (file)
@@ -1,6 +1,6 @@
 /* PR middle-end/50141 */
 /* { dg-do compile } */
-/* { dg-options "-O2 --param allow-store-data-races=0" } */
+/* { dg-options "-O2 -fno-allow-store-data-races" } */
 
 struct S
 {
index 9ca3a67f3c42a248ff54278d36b669f66d15287f..89d4d082ed868f35556bdfa869db1368466dd6e5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index 0b29ffb68d4db25da80cf2447fe626cc13e3f46b..54f76b6da37c146e10d30eddcb26a99e1d5abc3b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link { target { ! int16 } } } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index 78f4d75c8ba7755b0e42bf503455648144bd6737..5d2feed9f034a20c9db08572ff100865c24138ac 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index cd6badf33295e5a6589c19b2fb8d461a47b5c042..84aad5e9e216f2672bd8685df729d3029e023cab 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index be5d1eae5c421447e3e56a772987c0b4ddd33791..e5a5ad5f1c3f45c8171d22bef652fb2ec408c742 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 /* Test that setting <var.a> does not touch either <var.b> or <var.c>.
index b829587276b2f764dfaec927b264777c1e9af4c4..9d1d0622c1d0693cccdb96c5330223e52e37801a 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 /* Test that setting <var.a> does not touch either <var.b> or <var.c>.
index 1b3fda3b91139893aa7e3b5dc4fc437cccbedfb6..701a951c0b43b036b80c74b766e5dc2f0cb9a537 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-lto-do link } */
-/* { dg-lto-options { { -O -flto -fexceptions -fnon-call-exceptions --param allow-store-data-races=0 } } } */
+/* { dg-lto-options { { -O -flto -fexceptions -fnon-call-exceptions -fno-allow-store-data-races } } } */
 /* { dg-require-effective-target exceptions } */
 
 typedef struct { unsigned int e0 : 16; } s1;
index d4d28f5ed6078238519b8aa13c4a13a486be557a..e3e911808bf053b633cd32a0023a241d2b79071a 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0 -O2" } */
+/* { dg-options "-fno-allow-store-data-races -O2" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index 203c026048d4be65e6ee22756c69559fb5cf65ab..69f6683901ac9c9631108e1250c60b9258493ae5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0 -O2" } */
+/* { dg-options "-fno-allow-store-data-races -O2" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index 59f81b756be5c2c7ff21854c805af1a66e504ba3..b3784467dcec0800b741f17b8c86270e30acb9d8 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
index ff9d71e08754c24af9bbf551f0d6851f56ecfbeb..7afaabb150e22f68ec78f437dabf6032dc77cab5 100644 (file)
@@ -1,12 +1,12 @@
 /* { dg-do link } */
-/* { dg-options "--param allow-store-data-races=0" } */
+/* { dg-options "-fno-allow-store-data-races" } */
 /* { dg-final { simulate-thread } } */
 
 #include <stdio.h>
 #include "simulate-thread.h"
 
 /* This file tests that speculative store movement out of a loop doesn't 
-   happen.  This is disallowed when --param allow-store-data-races is 0.  */
+   happen.  This is disallowed when -fno-allow-store-data-races.  */
 
 int global = 100;
 
index fd9895b70201fe4971a64f418056d175329f7ce3..ffeffb4a01e3f06515401f1097ca380ef6508030 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-lim2-details --param allow-store-data-races=1" } */
+/* { dg-options "-O1 -fdump-tree-lim2-details -fallow-store-data-races" } */
 
 float a[100];
 
index 3c296ec300265b102d18fba23a293056828f3e75..df9046a301478f6769431a03f4d5567689308585 100644 (file)
@@ -914,10 +914,10 @@ ifcvt_memrefs_wont_trap (gimple *stmt, vec<data_reference_p> drs)
          to unconditionally.  */
       if (base_master_dr
          && DR_BASE_W_UNCONDITIONALLY (*base_master_dr))
-       return PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES);
+       return flag_store_data_races;
       /* or the base is known to be not readonly.  */
       else if (base_object_writable (DR_REF (a)))
-       return PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES);
+       return flag_store_data_races;
     }
 
   return false;
index c247d7433061e8395e50c0e481d609d530b98615..78664188c4594ece492e6826f8ec5df08da499f3 100644 (file)
@@ -2100,7 +2100,7 @@ execute_sm (class loop *loop, vec<edge> exits, im_mem_ref *ref)
   for_each_index (&ref->mem.ref, force_move_till, &fmt_data);
 
   if (bb_in_transaction (loop_preheader_edge (loop)->src)
-      || (! PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES)
+      || (! flag_store_data_races
          && ! ref_always_accessed_p (loop, ref, true)))
     multi_threaded_model_p = true;