From 8b76e7fef8246b7bb6f209b8ce0768d437b7b4a0 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Wed, 21 Oct 2015 21:18:17 +0000 Subject: [PATCH] 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. Co-Authored-By: Sebastian Pop From-SVN: r229150 --- gcc/ChangeLog | 7 +++++++ gcc/graphite-scop-detection.c | 11 +++++++++++ gcc/params.def | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f12681937f6..2c5af316d9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-10-21 Aditya Kumar + Sebastian Pop + + * 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 * config.in: Regenerate. diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 3ce4ff1ba92..08c7b3abd83 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1777,6 +1777,17 @@ build_scops (vec *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); diff --git a/gcc/params.def b/gcc/params.def index dd073019d69..2df47d7add3 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, -- 2.30.2