diff mbox

Use DR_IS_WRITE instead of !DR_IS_READ.

Message ID 1283544299-18814-1-git-send-email-sebpop@gmail.com
State New
Headers show

Commit Message

Sebastian Pop Sept. 3, 2010, 8:04 p.m. UTC
I committed this patch to trunk after bootstrap and regression test on
amd64-linux.

Sebastian

2010-09-03  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-data-ref.c (dr_may_alias_p): Replace !DR_IS_READ with
	DR_IS_WRITE.
	(compute_all_dependences): Same.
	(create_rdg_edge_for_ddr): Same.
	* tree-data-ref.h (DR_IS_WRITE): New.
	(ddr_is_anti_dependent): Replace !DR_IS_READ with DR_IS_WRITE.
	* tree-if-conv.c (write_memrefs_written_at_least_once): Same.
	(write_memrefs_written_at_least_once): Same.
	* tree-predcom.c (suitable_component_p): Same.
	(determine_roots_comp): Same.
	(execute_load_motion): Same.
	* tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Same.
	(vect_enhance_data_refs_alignment): Same.
	(vect_analyze_group_access): Same.
---
 gcc/ChangeLog             |   17 +++++++++++++++++
 gcc/tree-data-ref.c       |   14 +++++++-------
 gcc/tree-data-ref.h       |    3 ++-
 gcc/tree-if-conv.c        |    4 ++--
 gcc/tree-predcom.c        |    8 ++++----
 gcc/tree-vect-data-refs.c |   14 +++++++-------
 6 files changed, 39 insertions(+), 21 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af1c53e..19b86e1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@ 
+2010-09-03  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* tree-data-ref.c (dr_may_alias_p): Replace !DR_IS_READ with
+	DR_IS_WRITE.
+	(compute_all_dependences): Same.
+	(create_rdg_edge_for_ddr): Same.
+	* tree-data-ref.h (DR_IS_WRITE): New.
+	(ddr_is_anti_dependent): Replace !DR_IS_READ with DR_IS_WRITE.
+	* tree-if-conv.c (write_memrefs_written_at_least_once): Same.
+	(write_memrefs_written_at_least_once): Same.
+	* tree-predcom.c (suitable_component_p): Same.
+	(determine_roots_comp): Same.
+	(execute_load_motion): Same.
+	* tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Same.
+	(vect_enhance_data_refs_alignment): Same.
+	(vect_analyze_group_access): Same.
+
 2010-09-03  Joern Rennecke  <joern.rennecke@embecosm.com>
 
 	PR testsuite/42843
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index ee181a6..e1d2dfc 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1335,12 +1335,12 @@  dr_may_alias_p (const struct data_reference *a, const struct data_reference *b)
     return false;
 
   /* Query the alias oracle.  */
-  if (!DR_IS_READ (a) && !DR_IS_READ (b))
+  if (DR_IS_WRITE (a) && DR_IS_WRITE (b))
     {
       if (!refs_output_dependent_p (DR_REF (a), DR_REF (b)))
 	return false;
     }
-  else if (DR_IS_READ (a) && !DR_IS_READ (b))
+  else if (DR_IS_READ (a) && DR_IS_WRITE (b))
     {
       if (!refs_anti_dependent_p (DR_REF (a), DR_REF (b)))
 	return false;
@@ -1372,7 +1372,7 @@  dr_may_alias_p (const struct data_reference *a, const struct data_reference *b)
     decl_b = SSA_NAME_VAR (addr_b);
 
   if (TYPE_RESTRICT (type_a) && TYPE_RESTRICT (type_b)
-      && (!DR_IS_READ (a) || !DR_IS_READ (b))
+      && (DR_IS_WRITE (a) || DR_IS_WRITE (b))
       && decl_a && DECL_P (decl_a)
       && decl_b && DECL_P (decl_b)
       && decl_a != decl_b
@@ -4107,7 +4107,7 @@  compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
 
   FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, a)
     for (j = i + 1; VEC_iterate (data_reference_p, datarefs, j, b); j++)
-      if (!DR_IS_READ (a) || !DR_IS_READ (b) || compute_self_and_rr)
+      if (DR_IS_WRITE (a) || DR_IS_WRITE (b) || compute_self_and_rr)
 	{
 	  ddr = initialize_data_dependence_relation (a, b, loop_nest);
 	  VEC_safe_push (ddr_p, heap, *dependence_relations, ddr);
@@ -4772,11 +4772,11 @@  create_rdg_edge_for_ddr (struct graph *rdg, ddr_p ddr)
   /* Determines the type of the data dependence.  */
   if (DR_IS_READ (dra) && DR_IS_READ (drb))
     RDGE_TYPE (e) = input_dd;
-  else if (!DR_IS_READ (dra) && !DR_IS_READ (drb))
+  else if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb))
     RDGE_TYPE (e) = output_dd;
-  else if (!DR_IS_READ (dra) && DR_IS_READ (drb))
+  else if (DR_IS_WRITE (dra) && DR_IS_READ (drb))
     RDGE_TYPE (e) = flow_dd;
-  else if (DR_IS_READ (dra) && !DR_IS_READ (drb))
+  else if (DR_IS_READ (dra) && DR_IS_WRITE (drb))
     RDGE_TYPE (e) = anti_dd;
 }
 
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 757c3c1..844a2ae 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -193,6 +193,7 @@  struct data_reference
 #define DR_ACCESS_FN(DR, I)        VEC_index (tree, DR_ACCESS_FNS (DR), I)
 #define DR_NUM_DIMENSIONS(DR)      VEC_length (tree, DR_ACCESS_FNS (DR))
 #define DR_IS_READ(DR)             (DR)->is_read
+#define DR_IS_WRITE(DR)            (!DR_IS_READ (DR))
 #define DR_BASE_ADDRESS(DR)        (DR)->innermost.base_address
 #define DR_OFFSET(DR)              (DR)->innermost.offset
 #define DR_INIT(DR)                (DR)->innermost.init
@@ -473,7 +474,7 @@  ddr_is_anti_dependent (ddr_p ddr)
 {
   return (DDR_ARE_DEPENDENT (ddr) == NULL_TREE
 	  && DR_IS_READ (DDR_A (ddr))
-	  && !DR_IS_READ (DDR_B (ddr))
+	  && DR_IS_WRITE (DDR_B (ddr))
 	  && !same_access_functions (ddr));
 }
 
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 86b8f26..e92090f 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -533,7 +533,7 @@  write_memrefs_written_at_least_once (gimple stmt,
 
   for (i = 0; VEC_iterate (data_reference_p, drs, i, a); i++)
     if (DR_STMT (a) == stmt
-	&& !DR_IS_READ (a))
+	&& DR_IS_WRITE (a))
       {
 	bool found = false;
 	int x = DR_WRITTEN_AT_LEAST_ONCE (a);
@@ -546,7 +546,7 @@  write_memrefs_written_at_least_once (gimple stmt,
 
 	for (j = 0; VEC_iterate (data_reference_p, drs, j, b); j++)
 	  if (DR_STMT (b) != stmt
-	      && !DR_IS_READ (b)
+	      && DR_IS_WRITE (b)
 	      && same_data_refs_base_objects (a, b))
 	    {
 	      tree cb = bb_predicate (gimple_bb (DR_STMT (b)));
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 712cc68..be2cfc4 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -829,7 +829,7 @@  suitable_component_p (struct loop *loop, struct component *comp)
       gcc_assert (dominated_by_p (CDI_DOMINATORS, ba, bp));
       bp = ba;
 
-      if (!DR_IS_READ (a->ref))
+      if (DR_IS_WRITE (a->ref))
 	has_write = true;
     }
 
@@ -1197,7 +1197,7 @@  determine_roots_comp (struct loop *loop,
 
   FOR_EACH_VEC_ELT (dref, comp->refs, i, a)
     {
-      if (!chain || !DR_IS_READ (a->ref)
+      if (!chain || DR_IS_WRITE (a->ref)
 	  || double_int_ucmp (uhwi_to_double_int (MAX_DISTANCE),
 			      double_int_sub (a->offset, last_ofs)) <= 0)
 	{
@@ -1611,7 +1611,7 @@  execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
   gcc_assert (chain->type == CT_INVARIANT);
   gcc_assert (!chain->combined);
   FOR_EACH_VEC_ELT (dref, chain->refs, i, a)
-    if (!DR_IS_READ (a->ref))
+    if (DR_IS_WRITE (a->ref))
       n_writes++;
 
   /* If there are no reads in the loop, there is nothing to do.  */
@@ -1627,7 +1627,7 @@  execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
       bool is_read = DR_IS_READ (a->ref);
       mark_virtual_ops_for_renaming (a->stmt);
 
-      if (!DR_IS_READ (a->ref))
+      if (DR_IS_WRITE (a->ref))
 	{
 	  n_writes--;
 	  if (n_writes)
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index c76c60b..7944d8b 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -614,7 +614,7 @@  vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
         }
 
       /* We do not vectorize basic blocks with write-write dependencies.  */
-      if (!DR_IS_READ (dra) && !DR_IS_READ (drb))
+      if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb))
         return true;
 
       /* We deal with read-write dependencies in basic blocks later (by
@@ -641,7 +641,7 @@  vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
         }
 
       /* Do not vectorize basic blcoks with write-write dependences.  */
-      if (!DR_IS_READ (dra) && !DR_IS_READ (drb))
+      if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb))
         return true;
 
       /* Check if this dependence is allowed in basic block vectorization.  */ 
@@ -1553,7 +1553,7 @@  vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
                       dr0 = dr;
                     }
 
-                  if (!first_store && !DR_IS_READ (dr))
+                  if (!first_store && DR_IS_WRITE (dr))
                     first_store = dr;
                 }
 
@@ -1565,7 +1565,7 @@  vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
               if (!supportable_dr_alignment)
                 {
                   dr0 = dr;
-                  if (!first_store && !DR_IS_READ (dr))
+                  if (!first_store && DR_IS_WRITE (dr))
                     first_store = dr;
                 }
             }
@@ -2078,7 +2078,7 @@  vect_analyze_group_access (struct data_reference *dr)
                                      DR_INIT (STMT_VINFO_DATA_REF (
 						   vinfo_for_stmt (next)))))
             {
-              if (!DR_IS_READ (data_ref))
+              if (DR_IS_WRITE (data_ref))
                 {
                   if (vect_print_dump_info (REPORT_DETAILS))
                     fprintf (vect_dump, "Two store stmts share the same dr.");
@@ -2123,7 +2123,7 @@  vect_analyze_group_access (struct data_reference *dr)
 	    {
 	      /* FORNOW: SLP of accesses with gaps is not supported.  */
 	      slp_impossible = true;
-	      if (!DR_IS_READ (data_ref))
+	      if (DR_IS_WRITE (data_ref))
 		{
 		  if (vect_print_dump_info (REPORT_DETAILS))
 		    fprintf (vect_dump, "interleaved store with gaps");
@@ -2215,7 +2215,7 @@  vect_analyze_group_access (struct data_reference *dr)
 
       /* SLP: create an SLP data structure for every interleaving group of
 	 stores for further analysis in vect_analyse_slp.  */
-      if (!DR_IS_READ (dr) && !slp_impossible)
+      if (DR_IS_WRITE (dr) && !slp_impossible)
         {
           if (loop_vinfo)
             VEC_safe_push (gimple, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo),