re PR tree-optimization/50698 (pretending to create versioning for alias when not...
authorRichard Guenther <rguenther@suse.de>
Thu, 13 Oct 2011 09:00:01 +0000 (09:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 13 Oct 2011 09:00:01 +0000 (09:00 +0000)
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.

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

From-SVN: r179895

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

index 017594f98dfa7b664da2250abce004cd176197fe..01d21350dee5670ad30d7138c1b60f8eda0948ed 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 998e06b992a12846cee05f14967a4a8e94ae70da..ea7d8d8580a3511f3851cc000c958d57523c9c76 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 a4c9367d9c674b316092e53087bd3782660dd636..053ffea1303816174a1a74d3ccc986ade51083e3 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);