+2007-02-12 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/29145
+ * tree-data-ref.c (base_addr_differ_p): Make us more conservative
+ in our handling of restrict qualified pointers.
+
2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651
+2007-02-12 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/29145
+ * gcc.dg/vect/vect-74.c: Xfail the test - cannot be vectorized until
+ alias analysis is improved to take better advantage of restrict
+ qualified pointers.
+ * gcc.dg/vect/vect-80.c: Likewise.
+ * gcc.dg/vect/pr29145.c: New.
+
2007-02-11 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/sse4a-extract.c: Add "LL" to 64bit constants.
--- /dev/null
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+void with_restrict(int * __restrict p)
+{
+ int i;
+ int *q = p - 2;
+
+ for (i = 0; i < 1000; ++i) {
+ p[i] = q[i];
+ }
+}
+
+void without_restrict(int * p)
+{
+ int i;
+ int *q = p - 2;
+
+ for (i = 0; i < 1000; ++i) {
+ p[i] = q[i];
+ }
+}
+
+int main(void)
+{
+ int i;
+ int a[1002];
+ int b[1002];
+
+ for (i = 0; i < 1002; ++i) {
+ a[i] = b[i] = i;
+ }
+
+ with_restrict(a + 2);
+ without_restrict(b + 2);
+
+ for (i = 0; i < 1002; ++i) {
+ if (a[i] != b[i])
+ abort();
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */
+/* Xfail until handling restrict is refined. See pr29145 */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+/* Uncomment when this testcase gets vectorized again:
+ dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } }
+ dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
+*/
/* { dg-final { cleanup-tree-dump "vect" } } */
all three accesses (peeling to align the store will not force the
two loads to be aligned). */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
+/* Uncomment when this testcase gets vectorized again:
+ dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } }
+*/
/* { dg-final { cleanup-tree-dump "vect" } } */
tree addr_a = DR_BASE_ADDRESS (dra);
tree addr_b = DR_BASE_ADDRESS (drb);
tree type_a, type_b;
+ tree decl_a, decl_b;
bool aliased;
if (!addr_a || !addr_b)
}
/* An instruction writing through a restricted pointer is "independent" of any
- instruction reading or writing through a different pointer, in the same
- block/scope. */
- else if ((TYPE_RESTRICT (type_a) && !DR_IS_READ (dra))
- || (TYPE_RESTRICT (type_b) && !DR_IS_READ (drb)))
+ instruction reading or writing through a different restricted pointer,
+ in the same block/scope. */
+ else if (TYPE_RESTRICT (type_a)
+ && TYPE_RESTRICT (type_b)
+ && (!DR_IS_READ (drb) || !DR_IS_READ (dra))
+ && TREE_CODE (DR_BASE_ADDRESS (dra)) == SSA_NAME
+ && (decl_a = SSA_NAME_VAR (DR_BASE_ADDRESS (dra)))
+ && TREE_CODE (decl_a) == PARM_DECL
+ && TREE_CODE (DECL_CONTEXT (decl_a)) == FUNCTION_DECL
+ && TREE_CODE (DR_BASE_ADDRESS (drb)) == SSA_NAME
+ && (decl_b = SSA_NAME_VAR (DR_BASE_ADDRESS (drb)))
+ && TREE_CODE (decl_b) == PARM_DECL
+ && TREE_CODE (DECL_CONTEXT (decl_b)) == FUNCTION_DECL
+ && DECL_CONTEXT (decl_a) == DECL_CONTEXT (decl_b))
{
*differ_p = true;
return true;
}
+
return false;
}