From 84e9670514d751c49ea70db115f9d8ef8d2aa934 Mon Sep 17 00:00:00 2001 From: spop 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229150 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 f126819..2c5af31 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 3ce4ff1..08c7b3ab 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 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, -- 2.7.4