add an upper limit on the number of array references
authorAditya Kumar <aditya.k7@samsung.com>
Wed, 21 Oct 2015 21:18:17 +0000 (21:18 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Wed, 21 Oct 2015 21:18:17 +0000 (21:18 +0000)
* graphite-scop-detection.c (build_scops): Do not handle scops with more
than PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP arrays.
* params.def (PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP): New.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r229150

gcc/ChangeLog
gcc/graphite-scop-detection.c
gcc/params.def

index f12681937f676ff7fd568c3e16e6bbceecc0761a..2c5af316d9e315cf26b43333ec8be661f39d520f 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-21  Aditya Kumar  <aditya.k7@samsung.com>
+           Sebastian Pop  <s.pop@samsung.com>
+
+       * graphite-scop-detection.c (build_scops): Do not handle scops with more
+       than PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP arrays.
+       * params.def (PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP): New.
+
 2015-10-21  Mikhail Maltsev  <maltsevm@gmail.com>
 
        * config.in: Regenerate.
index 3ce4ff1ba92f7b35f1b1ad6a581cbb272cfe0031..08c7b3abd83eeabc177b3cd6a520a970d3108941 100644 (file)
@@ -1777,6 +1777,17 @@ build_scops (vec<scop_p> *scops)
          continue;
        }
 
+      unsigned max_arrays = PARAM_VALUE (PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP);
+      if (scop->drs.length () >= max_arrays)
+       {
+         DEBUG_PRINT (dp << "[scop-detection-fail] too many data references: "
+                      << scop->drs.length ()
+                      << " is larger than --param graphite-max-arrays-per-scop="
+                      << max_arrays << ".\n");
+         free_scop (scop);
+         continue;
+       }
+
       build_sese_loop_nests (scop->scop_info);
 
       find_scop_parameters (scop);
index dd073019d691d81e935aaf866e5a971e5abda8db..2df47d7add30284e3cb66c5af646694c92424682 100644 (file)
@@ -849,6 +849,13 @@ DEFPARAM (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION,
          "maximum number of basic blocks per function to be analyzed by Graphite",
          100, 0, 0)
 
+/* Maximal number of array references in a scop.  */
+
+DEFPARAM (PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP,
+         "graphite-max-arrays-per-scop",
+         "maximum number of arrays per scop",
+         100, 0, 0)
+
 /* Maximal number of basic blocks in the functions analyzed by Graphite.  */
 
 DEFPARAM (PARAM_GRAPHITE_MIN_LOOPS_PER_FUNCTION,