OSDN Git Service

2011-10-13 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2011 09:00:01 +0000 (09:00 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 13 Oct 2011 09:00:01 +0000 (09:00 +0000)
PR tree-optimization/50698
* tree-data-ref.c (split_constant_offset_1): Also process
offsets of &MEM.

* g++.dg/vect/pr50698.cc: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/vect/pr50698.cc [new file with mode: 0644]
gcc/tree-data-ref.c

index 017594f..01d2135 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/50698
+       * tree-data-ref.c (split_constant_offset_1): Also process
+       offsets of &MEM.
+
 2011-10-12  David S. Miller  <davem@davemloft.net>
 
        * config/sparc/sparc.h: Do not force TARGET_VIS3 and TARGET_FMAF
index 998e06b..ea7d8d8 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/50698
+       * g++.dg/vect/pr50698.cc: New testcase.
+
 2011-10-12  Janis Johnson  <janisjo@codesourcery.com>
 
        * gcc.target/powerpc/warn-1.c: Skip if not powerpc_vsx_ok.
diff --git a/gcc/testsuite/g++.dg/vect/pr50698.cc b/gcc/testsuite/g++.dg/vect/pr50698.cc
new file mode 100644 (file)
index 0000000..acb1936
--- /dev/null
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-require-effective-target vect_float }
+
+float mem[4096];
+const int N=1024;
+
+struct XYZ {
+    float * mem;
+    int n;
+    float * x() { return mem;}
+    float * y() { return x()+n;}
+    float * z() { return y()+n;}
+};
+
+inline
+void sum(float * x, float * y, float * z, int n) {
+    for (int i=0;i!=n; ++i)
+      x[i]=y[i]+z[i];
+}
+
+void sumS() {
+    XYZ xyz; xyz.mem=mem; xyz.n=N;
+    sum(xyz.x(),xyz.y(),xyz.z(),xyz.n);
+}
+
+// { dg-final { scan-tree-dump-not "run-time aliasing" "vect" } }
+// { dg-final { cleanup-tree-dump "vect" } }
index a4c9367..053ffea 100644 (file)
@@ -589,9 +589,6 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1,
        int punsignedp, pvolatilep;
 
        op0 = TREE_OPERAND (op0, 0);
-       if (!handled_component_p (op0))
-         return false;
-
        base = get_inner_reference (op0, &pbitsize, &pbitpos, &poffset,
                                    &pmode, &punsignedp, &pvolatilep, false);