This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] [graphite] add an upper limit on the number of array references


	* 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.
---
 gcc/graphite-scop-detection.c | 11 +++++++++++
 gcc/params.def                |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 6c0987d..f425f01 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -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->region);
 
       find_scop_parameters (scop);
diff --git a/gcc/params.def b/gcc/params.def
index dd07301..2df47d7 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -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,
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]