OSDN Git Service

PR 17051
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Aug 2004 23:33:46 +0000 (23:33 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Aug 2004 23:33:46 +0000 (23:33 +0000)
        * tree-sra.c (scalarize_use): Mark all v_defs for !is_output too.

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

gcc/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20040817-1.c [new file with mode: 0644]
gcc/tree-sra.c

index 81822a2..3e3252d 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-17  Richard Henderson  <rth@redhat.com>
+
+       PR 17051
+       * tree-sra.c (scalarize_use): Mark all v_defs for !is_output too.
+
 2004-08-17  DJ Delorie  <dj@redhat.com>
 
        * doc/extend.texi: Document new xstormy16 attribute.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040817-1.c b/gcc/testsuite/gcc.c-torture/compile/20040817-1.c
new file mode 100644 (file)
index 0000000..158596c
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR 17051: SRA failed to rename the VOPS properly.  */
+
+struct A
+{
+    char c, d;
+};
+
+void foo(struct A *p)
+{
+    struct A a = *p;
+
+    if (p->c)
+        bar1(a);
+    else
+    {
+        if (p) bar2(a,a.c);
+        bar3(a.c);
+    }
+}
index b3fa20c..e6b254c 100644 (file)
@@ -1780,11 +1780,9 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
       generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
       if (list == NULL)
        return;
+      mark_all_v_defs (expr_first (list));
       if (is_output)
-       {
-         mark_all_v_defs (expr_first (list));
-         sra_insert_after (bsi, list);
-       }
+       sra_insert_after (bsi, list);
       else
        sra_insert_before (bsi, list);
     }