diff options
author | Bernd Schmidt <bernds@redhat.com> | 2015-11-27 10:05:36 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2015-11-27 10:05:36 +0000 |
commit | c000cd7c93aa657aae1cdfd6ce9b950b78c79624 (patch) | |
tree | 1f99eda41a82e61f545b497246278ba9cd804341 /gcc | |
parent | 4d7b2a8a3b12beac09c5d8f8bcbf43a81296e462 (diff) | |
download | gcc-c000cd7c93aa657aae1cdfd6ce9b950b78c79624.zip gcc-c000cd7c93aa657aae1cdfd6ce9b950b78c79624.tar.gz gcc-c000cd7c93aa657aae1cdfd6ce9b950b78c79624.tar.bz2 |
Be more careful about barriers when speculating conditional stores.
* gimple.h (nonbarrier_call_p): Declare.
* gimple.c (nonbarrier_call_p): New function.
* tree-ssa-phiopt.c (nontrapping_dom_walker::before_dom_children):
Also increment call phase for ASMs with vdef and potential barrier
calls.
From-SVN: r231005
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gimple.c | 12 | ||||
-rw-r--r-- | gcc/gimple.h | 1 | ||||
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 4 |
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4510240..e9fbabf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-11-27 Bernd Schmidt <bschmidt@redhat.com> + + * gimple.h (nonbarrier_call_p): Declare. + * gimple.c (nonbarrier_call_p): New function. + * tree-ssa-phiopt.c (nontrapping_dom_walker::before_dom_children): + Also increment call phase for ASMs with vdef and potential barrier + calls. + 2015-11-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * ifcvt.c (insn_valid_noce_process_p): Reject insn if it satisfies diff --git a/gcc/gimple.c b/gcc/gimple.c index 2764df8..bf552a7 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2636,6 +2636,18 @@ nonfreeing_call_p (gimple *call) return n->nonfreeing_fn; } +/* Return true when CALL is a call stmt that definitely need not + be considered to be a memory barrier. */ +bool +nonbarrier_call_p (gimple *call) +{ + if (gimple_call_flags (call) & (ECF_PURE | ECF_CONST)) + return true; + /* Should extend this to have a nonbarrier_fn flag, just as above in + the nonfreeing case. */ + return false; +} + /* Callback for walk_stmt_load_store_ops. Return TRUE if OP will dereference the tree stored in DATA, FALSE diff --git a/gcc/gimple.h b/gcc/gimple.h index 6eb22de..0b04804 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1507,6 +1507,7 @@ extern bool gimple_call_builtin_p (const gimple *, enum built_in_function); extern bool gimple_asm_clobbers_memory_p (const gasm *); extern void dump_decl_set (FILE *, bitmap); extern bool nonfreeing_call_p (gimple *); +extern bool nonbarrier_call_p (gimple *); extern bool infer_nonnull_range (gimple *, tree); extern bool infer_nonnull_range_by_dereference (gimple *, tree); extern bool infer_nonnull_range_by_attribute (gimple *, tree); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 02d5aa0..344cd2f 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1519,7 +1519,9 @@ nontrapping_dom_walker::before_dom_children (basic_block bb) { gimple *stmt = gsi_stmt (gsi); - if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt)) + if ((gimple_code (stmt) == GIMPLE_ASM && gimple_vdef (stmt)) + || (is_gimple_call (stmt) + && (!nonfreeing_call_p (stmt) || !nonbarrier_call_p (stmt)))) nt_call_phase++; else if (gimple_assign_single_p (stmt) && !gimple_has_volatile_ops (stmt)) { |