From: Bernd Schmidt Date: Fri, 27 Nov 2015 10:05:36 +0000 (+0000) Subject: Be more careful about barriers when speculating conditional stores. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c000cd7c93aa657aae1cdfd6ce9b950b78c79624;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4510240eb22..e9fbabf6671 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-11-27 Bernd Schmidt + + * 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 * ifcvt.c (insn_valid_noce_process_p): Reject insn if it satisfies diff --git a/gcc/gimple.c b/gcc/gimple.c index 2764df88186..bf552a7ae9c 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 6eb22de1e5e..0b04804ce46 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 02d5aa010c3..344cd2f2701 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)) {