OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Jul 2011 12:37:03 +0000 (12:37 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Jul 2011 12:37:03 +0000 (12:37 +0000)
PR tree-optimization/49742
* tree-data-ref.c (get_references_in_stmt): Treat the lhs of a call
as a potential write.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176446 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-data-ref.c

index 2982c9b..ee76d11 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-19  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       PR tree-optimization/49742
+       * tree-data-ref.c (get_references_in_stmt): Treat the lhs of a call
+       as a potential write.
+
 2011-07-19  Richard Guenther  <rguenther@suse.de>
 
        * gimplify.c (gimplify_expr): Gimplify TRUTH_NOT_EXPR as
 2011-07-19  Richard Guenther  <rguenther@suse.de>
 
        * gimplify.c (gimplify_expr): Gimplify TRUTH_NOT_EXPR as
index d58542c..97be86c 100644 (file)
@@ -4158,33 +4158,37 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
          ref->pos = op1;
          ref->is_read = true;
        }
          ref->pos = op1;
          ref->is_read = true;
        }
-
-      if (DECL_P (*op0)
-         || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
-       {
-         ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
-         ref->pos = op0;
-         ref->is_read = false;
-       }
     }
   else if (stmt_code == GIMPLE_CALL)
     {
     }
   else if (stmt_code == GIMPLE_CALL)
     {
-      unsigned i, n = gimple_call_num_args (stmt);
+      unsigned i, n;
 
 
+      op0 = gimple_call_lhs_ptr (stmt);
+      n = gimple_call_num_args (stmt);
       for (i = 0; i < n; i++)
        {
       for (i = 0; i < n; i++)
        {
-         op0 = gimple_call_arg_ptr (stmt, i);
+         op1 = gimple_call_arg_ptr (stmt, i);
 
 
-         if (DECL_P (*op0)
-             || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
+         if (DECL_P (*op1)
+             || (REFERENCE_CLASS_P (*op1) && get_base_address (*op1)))
            {
              ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
            {
              ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
-             ref->pos = op0;
+             ref->pos = op1;
              ref->is_read = true;
            }
        }
     }
              ref->is_read = true;
            }
        }
     }
+  else
+    return clobbers_memory;
 
 
+  if (*op0
+      && (DECL_P (*op0)
+         || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0))))
+    {
+      ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
+      ref->pos = op0;
+      ref->is_read = false;
+    }
   return clobbers_memory;
 }
 
   return clobbers_memory;
 }