tree-if-conv.c (struct ifc_dr): Add new tree base_predicate field.
authorVenkataramanan Kumar <venkataramanan.kumar@amd.com>
Mon, 30 Nov 2015 07:59:54 +0000 (07:59 +0000)
committerVenkataramanan Kumar <vekumar@gcc.gnu.org>
Mon, 30 Nov 2015 07:59:54 +0000 (07:59 +0000)
2015-11-30  Venkataramanan Kumar  <Venkataramanan.Kumar@amd.com>

* 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

gcc/ChangeLog
gcc/tree-if-conv.c

index 3f6024ee3aef63c20fbb3e43308bb890668bc58b..3b93648f7867de7b7f4306269c482bbf98ce3757 100644 (file)
@@ -1,3 +1,12 @@
+2015-11-30  Venkataramanan Kumar  <Venkataramanan.Kumar@amd.com>
+
+       * 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  <hubicka@ucw.cz>
 
        * cgraph.c (cgraph_node::make_local): No name is unique during
index 01065cbf16e817afa95d39427163ffa2600487c4..f43942ddff0a842e520587e01c2e0e50e6649bd9 100644 (file)
@@ -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<data_reference_p> 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;
        }