]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Also handle ARRAY_REFs in instantiate_scev_r.
authorSebastian Pop <sebastian.pop@amd.com>
Thu, 30 Sep 2010 21:18:48 +0000 (21:18 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Thu, 30 Sep 2010 21:18:48 +0000 (21:18 +0000)
2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>

* tree-scalar-evolution.c (instantiate_array_ref): New.
(instantiate_scev_r): Also handle ARRAY_REFs.

From-SVN: r164790

gcc/ChangeLog
gcc/ChangeLog.graphite
gcc/tree-scalar-evolution.c

index bd84f6691658581eedf26da688635456a0ede0f3..cc30d34fd7418d99ba85f37a6b0b89b5289ce580 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * tree-scalar-evolution.c (instantiate_array_ref): New.
+       (instantiate_scev_r): Also handle ARRAY_REFs.
+
 2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
 
        * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
index ea6bb12e4c70ae7cf697bfeb6026c2b1836ae7d4..0cc7fa08f3889404a750a48fac16c214b60c669c 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>
+
+       * tree-scalar-evolution.c (instantiate_array_ref): New.
+       (instantiate_scev_r): Also handle ARRAY_REFs.
+
 2010-08-20  Sebastian Pop  <sebastian.pop@amd.com>
 
        * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
index a7e165aed3f118be26facf3c62bc33ac83796fab..8a5797eb827f4a8f606cd850c0597c351f6bf4e3 100644 (file)
@@ -2334,6 +2334,41 @@ instantiate_scev_binary (basic_block instantiate_below,
   return chrec ? chrec : fold_build2 (code, type, c0, c1);
 }
 
+/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
+   and EVOLUTION_LOOP, that were left under a symbolic form.
+
+   "CHREC" is an array reference to be instantiated.
+
+   CACHE is the cache of already instantiated values.
+
+   FOLD_CONVERSIONS should be set to true when the conversions that
+   may wrap in signed/pointer type are folded, as long as the value of
+   the chrec is preserved.
+
+   SIZE_EXPR is used for computing the size of the expression to be
+   instantiated, and to stop if it exceeds some limit.  */
+
+static tree
+instantiate_array_ref (basic_block instantiate_below,
+                      struct loop *evolution_loop, tree chrec,
+                      bool fold_conversions, htab_t cache, int size_expr)
+{
+  tree res;
+  tree index = TREE_OPERAND (chrec, 1);
+  tree op1 = instantiate_scev_r (instantiate_below, evolution_loop, index,
+                                fold_conversions, cache, size_expr);
+
+  if (op1 == chrec_dont_know)
+    return chrec_dont_know;
+
+  if (chrec && op1 == index)
+    return chrec;
+
+  res = unshare_expr (chrec);
+  TREE_OPERAND (res, 1) = op1;
+  return res;
+}
+
 /* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
    and EVOLUTION_LOOP, that were left under a symbolic form.
 
@@ -2613,6 +2648,10 @@ instantiate_scev_r (basic_block instantiate_below,
     case SCEV_KNOWN:
       return chrec_known;
 
+    case ARRAY_REF:
+      return instantiate_array_ref (instantiate_below, evolution_loop, chrec,
+                                   fold_conversions, cache, size_expr);
+
     default:
       break;
     }