diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2024-08-08 16:37:28 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2024-08-09 14:49:46 -0400 |
commit | 9e4da946c4263a4c89d5fc365b3c97ae244c5018 (patch) | |
tree | 5b5c0e047dde6043301112c2ac64ccf94d81dcc9 | |
parent | 5ce3874b3c2fdd76f506005cb1171a732af7c807 (diff) | |
download | gcc-9e4da946c4263a4c89d5fc365b3c97ae244c5018.zip gcc-9e4da946c4263a4c89d5fc365b3c97ae244c5018.tar.gz gcc-9e4da946c4263a4c89d5fc365b3c97ae244c5018.tar.bz2 |
Adjust rangers recomputation depth based on the number of BBs.
As the number of block increase, recomputations can become more
expensive. Adjust the depth limit to avoid excessive compile time.
PR tree-optimization/114855
* gimple-range-gori.cc (gori_compute::gori_compute): Adjust
ranger_recompute_depth limit based on the number of BBs.
(gori_compute::may_recompute_p): Use previosuly calculated value.
* gimple-range-gori.h (gori_compute::m_recompute_depth): New.
-rw-r--r-- | gcc/gimple-range-gori.cc | 12 | ||||
-rw-r--r-- | gcc/gimple-range-gori.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index a31e3be..f2e2b50 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -567,6 +567,13 @@ gori_compute::gori_compute (gori_map &map, int not_executable_flag, m_bool_one = range_true (); if (dump_file && (param_ranger_debug & RANGER_DEBUG_GORI)) tracer.enable_trace (); + + // Reduce maximum recompute depth based on the size of the CFG to avoid + // excessive compuations in large CFGs. + m_recompute_depth = (int) param_ranger_recompute_depth + - (int) last_basic_block_for_fn (cfun) / 4096; + if (m_recompute_depth < 1) + m_recompute_depth = 1; } gori_compute::~gori_compute () @@ -1327,10 +1334,7 @@ gori_compute::may_recompute_p (tree name, basic_block bb, int depth) { // -1 indicates a default param, convert it to the real default. if (depth == -1) - { - depth = (int)param_ranger_recompute_depth; - gcc_checking_assert (depth >= 1); - } + depth = m_recompute_depth; bool res = m_map.is_export_p (dep1, bb); if (res || depth <= 1) diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h index 11019e3..97e051c 100644 --- a/gcc/gimple-range-gori.h +++ b/gcc/gimple-range-gori.h @@ -206,6 +206,7 @@ private: range_tracer tracer; int m_not_executable_flag; + int m_recompute_depth; }; // These APIs are used to query GORI if there are ranges generated on an edge. |