Commit e622a32d by Richard Biener Committed by Richard Biener

re PR middle-end/92046 (Command line options (that are per-functions) are…

re PR middle-end/92046 (Command line options (that are per-functions) are affecting --params which are global.)

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
parent 3c8e341b
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> 2019-10-15 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR tree-optimization/92085 PR tree-optimization/92085
......
...@@ -993,6 +993,10 @@ Align the start of loops. ...@@ -993,6 +993,10 @@ Align the start of loops.
falign-loops= falign-loops=
Common RejectNegative Joined Var(str_align_loops) Optimization 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 fargument-alias
Common Ignore Common Ignore
Does nothing. Preserved for backward compatibility. Does nothing. Preserved for backward compatibility.
......
...@@ -406,6 +406,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -406,6 +406,7 @@ Objective-C and Objective-C++ Dialects}.
-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
-falign-labels[=@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 -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 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
-fauto-inc-dec -fbranch-probabilities @gol -fauto-inc-dec -fbranch-probabilities @gol
-fcaller-saves @gol -fcaller-saves @gol
...@@ -8463,9 +8464,9 @@ designed to reduce code size. ...@@ -8463,9 +8464,9 @@ designed to reduce code size.
Disregard strict standards compliance. @option{-Ofast} enables all Disregard strict standards compliance. @option{-Ofast} enables all
@option{-O3} optimizations. It also enables optimizations that are not @option{-O3} optimizations. It also enables optimizations that are not
valid for all standard-compliant programs. valid for all standard-compliant programs.
It turns on @option{-ffast-math} and the Fortran-specific It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
@option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is and the Fortran-specific @option{-fstack-arrays}, unless
specified, and @option{-fno-protect-parens}. @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
@item -Og @item -Og
@opindex Og @opindex Og
...@@ -10227,6 +10228,12 @@ The maximum allowed @var{n} option value is 65536. ...@@ -10227,6 +10228,12 @@ The maximum allowed @var{n} option value is 65536.
Enabled at levels @option{-O2}, @option{-O3}. 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 @item -funit-at-a-time
@opindex funit-at-a-time @opindex funit-at-a-time
This option is left for compatibility reasons. @option{-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 ...@@ -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 if either vectorization (@option{-ftree-vectorize}) or if-conversion
(@option{-ftree-loop-if-convert}) is disabled. (@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 @item case-values-threshold
The smallest number of different values for which it is best to use a 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 jump-table instead of a tree of conditional branches. If the value is
...@@ -564,6 +564,7 @@ static const struct default_options default_options_table[] = ...@@ -564,6 +564,7 @@ static const struct default_options default_options_table[] =
/* -Ofast adds optimizations to -O3. */ /* -Ofast adds optimizations to -O3. */
{ OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 }, { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },
{ OPT_LEVELS_FAST, OPT_fallow_store_data_races, NULL, 1 },
{ OPT_LEVELS_NONE, 0, NULL, 0 } { OPT_LEVELS_NONE, 0, NULL, 0 }
}; };
...@@ -671,13 +672,6 @@ default_options_optimization (struct gcc_options *opts, ...@@ -671,13 +672,6 @@ default_options_optimization (struct gcc_options *opts,
opt2 ? 100 : default_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE), opt2 ? 100 : default_param_value (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE),
opts->x_param_values, opts_set->x_param_values); 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) if (opts->x_optimize_size)
/* We want to crossjump as much as possible. */ /* We want to crossjump as much as possible. */
maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1, maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
......
...@@ -1225,12 +1225,6 @@ DEFPARAM (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SPEED, ...@@ -1225,12 +1225,6 @@ DEFPARAM (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SPEED,
"optimizing for speed.", "optimizing for speed.",
800, 0, 0) 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. */ /* Reassociation width to be used by tree reassoc optimization. */
DEFPARAM (PARAM_TREE_REASSOC_WIDTH, DEFPARAM (PARAM_TREE_REASSOC_WIDTH,
"tree-reassoc-width", "tree-reassoc-width",
......
...@@ -228,8 +228,6 @@ extern void init_param_values (int *params); ...@@ -228,8 +228,6 @@ extern void init_param_values (int *params);
PARAM_VALUE (PARAM_MAX_STORES_TO_SINK) PARAM_VALUE (PARAM_MAX_STORES_TO_SINK)
#define ALLOW_LOAD_DATA_RACES \ #define ALLOW_LOAD_DATA_RACES \
PARAM_VALUE (PARAM_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 \ #define ALLOW_PACKED_LOAD_DATA_RACES \
PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES) PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES)
#define ALLOW_PACKED_STORE_DATA_RACES \ #define ALLOW_PACKED_STORE_DATA_RACES \
......
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> 2019-10-15 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR tree-optimization/92085 PR tree-optimization/92085
......
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { 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, /* Make sure we don't narrow down to a QI or HI to store into VAR.J,
but instead use an SI. */ but instead use an SI. */
......
/* PR middle-end/50141 */ /* PR middle-end/50141 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 --param allow-store-data-races=0" } */ /* { dg-options "-O2 -fno-allow-store-data-races" } */
struct S struct S
{ {
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link { target { ! int16 } } } */ /* { dg-do link { target { ! int16 } } } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
/* Test that setting <var.a> does not touch either <var.b> or <var.c>. /* Test that setting <var.a> does not touch either <var.b> or <var.c>.
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
/* Test that setting <var.a> does not touch either <var.b> or <var.c>. /* Test that setting <var.a> does not touch either <var.b> or <var.c>.
......
/* { dg-lto-do link } */ /* { 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 } */ /* { dg-require-effective-target exceptions } */
typedef struct { unsigned int e0 : 16; } s1; typedef struct { unsigned int e0 : 16; } s1;
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0 -O2" } */ /* { dg-options "-fno-allow-store-data-races -O2" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0 -O2" } */ /* { dg-options "-fno-allow-store-data-races -O2" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
......
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "--param allow-store-data-races=0" } */ /* { dg-options "-fno-allow-store-data-races" } */
/* { dg-final { simulate-thread } } */ /* { dg-final { simulate-thread } } */
#include <stdio.h> #include <stdio.h>
#include "simulate-thread.h" #include "simulate-thread.h"
/* This file tests that speculative store movement out of a loop doesn't /* 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; int global = 100;
......
/* { dg-do compile } */ /* { 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]; float a[100];
......
...@@ -914,10 +914,10 @@ ifcvt_memrefs_wont_trap (gimple *stmt, vec<data_reference_p> drs) ...@@ -914,10 +914,10 @@ ifcvt_memrefs_wont_trap (gimple *stmt, vec<data_reference_p> drs)
to unconditionally. */ to unconditionally. */
if (base_master_dr if (base_master_dr
&& DR_BASE_W_UNCONDITIONALLY (*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. */ /* or the base is known to be not readonly. */
else if (base_object_writable (DR_REF (a))) else if (base_object_writable (DR_REF (a)))
return PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES); return flag_store_data_races;
} }
return false; return false;
......
...@@ -2100,7 +2100,7 @@ execute_sm (class loop *loop, vec<edge> exits, im_mem_ref *ref) ...@@ -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); for_each_index (&ref->mem.ref, force_move_till, &fmt_data);
if (bb_in_transaction (loop_preheader_edge (loop)->src) 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))) && ! ref_always_accessed_p (loop, ref, true)))
multi_threaded_model_p = true; multi_threaded_model_p = true;
......
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