Fix PR48805: Do not instantiate ADDR_EXPRs
authorSebastian Pop <sebastian.pop@amd.com>
Tue, 26 Jul 2011 18:47:44 +0000 (18:47 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Tue, 26 Jul 2011 18:47:44 +0000 (18:47 +0000)
With this patch we avoid instantiating ADDR_EXPR: it makes no sense
to translate &b[i] into &b[{0, +, 1}_1].

Bootstrapped and tested on amd64-linux.

2011-07-26  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/48805
* tree-scalar-evolution.c (instantiate_scev_r): Return
chrec_dont_know for ADDR_EXPR.

* gcc.dg/graphite/id-pr48805.c: New.

From-SVN: r176801

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/id-pr48805.c [new file with mode: 0644]
gcc/tree-scalar-evolution.c

index 06e00746f8c8aa9b29c2e0672f30390243451a63..d3d99195889358797fb90cfc20f199a1bb0b70a7 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-26  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/48805
+       * tree-scalar-evolution.c (instantiate_scev_r): Return
+       chrec_dont_know for ADDR_EXPR.
+
 2011-07-26  Uros Bizjak  <ubizjak@gmail.com>
            H.J. Lu  <hongjiu.lu@intel.com>
 
index 1e351fec20e161a858b78c07a4e17d772a3639a1..4e0adb1490023647e635d0fba1fa09c615a2639a 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-26  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/48805
+       * gcc.dg/graphite/id-pr48805.c: New.
+
 2011-07-26  Tobias Burnus  <burnus@net-b.de>
 
        * gfortran.dg/coarray_lib_token_2.f90: New.
@@ -12,7 +17,7 @@
        PR tree-opt/49671
        * gcc.dg/tree-ssa/pr49671-1.c: New testcase.
        * gcc.dg/tree-ssa/pr49671-2.c: New testcase.
-       
+
 2011-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * lib/target-supports.exp (check_effective_target_mmap): New proc.
diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr48805.c b/gcc/testsuite/gcc.dg/graphite/id-pr48805.c
new file mode 100644 (file)
index 0000000..f13a828
--- /dev/null
@@ -0,0 +1,20 @@
+void *A(const void *a);
+void C(void);
+
+static void B(unsigned short a[])
+{
+  long i, j, tmp;
+
+  for(i = 0; i < 3; i++) {
+    for(j = 1; j <= 3; j++)
+      tmp -= a[i - j];
+
+    a[i] = (unsigned short)(tmp >> 1);
+  }
+}
+void C(void)
+{
+  unsigned short a[3], b[3];
+  B(b + 1);
+  A(a);
+}
index bfa8c93ae3846efbe43fc502134bd08023781708..00fcd3f359f9fbfeab19b8d1675a8e0dd659e1d3 100644 (file)
@@ -2645,6 +2645,7 @@ instantiate_scev_r (basic_block instantiate_below,
                                   TREE_OPERAND (chrec, 0),
                                   fold_conversions, cache, size_expr);
 
+    case ADDR_EXPR:
     case SCEV_NOT_KNOWN:
       return chrec_dont_know;