From: Venkataramanan Kumar Date: Mon, 30 Nov 2015 07:59:54 +0000 (+0000) Subject: tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b8320bc8bff1f2d0aa8229b7a44c7a713fd8ad4;p=gcc.git tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field. 2015-11-30 Venkataramanan Kumar * tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field. (hash_memrefs_baserefs_and_store_DRs_read_written_info): Hash base ref, DR pairs and store base_predicate for write type DRs. (ifcvt_memrefs_wont_trap): Guard checks with -ftree-loop-if-convert-stores flag. From-SVN: r231057 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f6024ee3ae..3b93648f786 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-11-30 Venkataramanan Kumar + + * tree-if-conv.c (struct ifc_dr): Add new tree + base_predicate field. + (hash_memrefs_baserefs_and_store_DRs_read_written_info): Hash + base ref, DR pairs and store base_predicate for write type DRs. + (ifcvt_memrefs_wont_trap): Guard checks with + -ftree-loop-if-convert-stores flag. + 2015-11-29 Jan Hubicka * cgraph.c (cgraph_node::make_local): No name is unique during diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 01065cbf16e..f43942ddff0 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -589,6 +589,8 @@ struct ifc_dr { int rw_unconditionally; tree predicate; + + tree base_predicate; }; #define IFC_DR(DR) ((struct ifc_dr *) (DR)->aux) @@ -636,22 +638,24 @@ hash_memrefs_baserefs_and_store_DRs_read_written_info (data_reference_p a) if (is_true_predicate (IFC_DR (*master_dr)->predicate)) DR_RW_UNCONDITIONALLY (*master_dr) = 1; - base_master_dr = &baseref_DR_map->get_or_insert (base_ref,&exist2); - - if (!exist2) + if (DR_IS_WRITE (a)) { - IFC_DR (a)->predicate = ca; - *base_master_dr = a; - } - else - IFC_DR (*base_master_dr)->predicate - = fold_or_predicates - (EXPR_LOCATION (IFC_DR (*base_master_dr)->predicate), - ca, IFC_DR (*base_master_dr)->predicate); + base_master_dr = &baseref_DR_map->get_or_insert (base_ref, &exist2); - if (DR_IS_WRITE (a) - && (is_true_predicate (IFC_DR (*base_master_dr)->predicate))) - DR_WRITTEN_AT_LEAST_ONCE (*base_master_dr) = 1; + if (!exist2) + { + IFC_DR (a)->base_predicate = ca; + *base_master_dr = a; + } + else + IFC_DR (*base_master_dr)->base_predicate + = fold_or_predicates + (EXPR_LOCATION (IFC_DR (*base_master_dr)->base_predicate), + ca, IFC_DR (*base_master_dr)->base_predicate); + + if (is_true_predicate (IFC_DR (*base_master_dr)->base_predicate)) + DR_WRITTEN_AT_LEAST_ONCE (*base_master_dr) = 1; + } } /* Return true when the memory references of STMT won't trap in the @@ -698,17 +702,19 @@ ifcvt_memrefs_wont_trap (gimple *stmt, vec drs) master_dr = ref_DR_map->get (ref_base_a); base_master_dr = baseref_DR_map->get (base); - gcc_assert (master_dr != NULL && base_master_dr != NULL); + gcc_assert (master_dr != NULL); if (DR_RW_UNCONDITIONALLY (*master_dr) == 1) { - if (DR_WRITTEN_AT_LEAST_ONCE (*base_master_dr) == 1) + if (base_master_dr + && DR_WRITTEN_AT_LEAST_ONCE (*base_master_dr) == 1) return true; else { tree base_tree = get_base_address (DR_REF (a)); if (DECL_P (base_tree) && decl_binds_to_current_def_p (base_tree) + && flag_tree_loop_if_convert_stores && !TREE_READONLY (base_tree)) return true; }