summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C83
-rw-r--r--gcc/tree-sra.c6
4 files changed, 97 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dd95c1b2ecd..f144088d9e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-29 Devang Patel <dpatel@apple.com>
+
+ * tree-sra.c (decide_block_copy): Disable scalarization of sub-elements.
+
2005-03-30 Stuart Hastings <stuart@apple.com>
Dale Johannesen <dalej@apple.com>
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 13fa5ac5a35..a02d78e5a07 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-30 Devang Patel <dpatel@apple.com>
+
+ * g++.dg/tree-sra/ssa-sra-3.C: New test.
+
2005-03-30 Dale Johannesen <dalej@apple.com>
* gcc.dg/20020919-1.c: Remove unnecessary conditional.
diff --git a/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C b/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C
new file mode 100644
index 00000000000..2a2d89c630d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/ssa-sra-3.C
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* Test check use_block_copy bit propagation in sra element hierarchy. */
+
+typedef unsigned char UINT8 ;
+typedef unsigned int UINT ;
+class C4
+{
+public:
+ int xy[2];
+};
+
+class C3
+{
+public:
+ inline void
+ Reset()
+ {
+ C4 const mvMax = {0x7fff, 0x7fff};
+
+ m42(0,mvMax);
+ m42(1,mvMax);
+ m43(0);
+ };
+
+ inline void m42 (UINT i, C4 mv)
+ {
+ mMv[i] = mv;
+ };
+
+
+
+ inline void m43(UINT j)
+ {
+ m44 (j);
+ d41 = j + 1;
+ };
+
+private:
+
+ C4 mMv[2];
+ UINT8 d41;
+ inline void m44 (UINT j) const {};
+};
+
+class C2
+{
+private:
+ bool valid;
+};
+
+class C1
+{
+public:
+ void m1(C3 *c);
+
+private:
+ const C2 * d1[2];
+ void m2(C3 *m);
+};
+
+void C1::m1 (C3 *r)
+{
+ C3 x;
+ m2(&x);
+}
+void C1::m2(C3 *x)
+{
+ C3 m3;
+ int i;
+ m3.Reset ();
+ for(i=0; i<2; i++)
+ {
+ const C2 * r = d1[i];
+ if (r!=__null)
+ {
+ C4 const c400 = {0,0};
+ m3.m42 (i, c400);
+
+ }
+ }
+}
+
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index f8aeebe573e..2fb23bd6022 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1299,6 +1299,12 @@ decide_block_copy (struct sra_elt *elt)
fputc ('\n', dump_file);
}
+ /* Disable scalarization of sub-elements */
+ for (c = elt->children; c; c = c->sibling)
+ {
+ c->cannot_scalarize = 1;
+ decide_block_copy (c);
+ }
return false;
}