From 3ca950c3525527846f13e8c547368ef432547a23 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 29 Sep 2021 17:25:50 -0400 Subject: Introduce a param-switch-limit for EVRP. Very large switches cause a lot of range calculations with multiple subranges to happen. This can cause quadratic or even exponetial time increases in large testcases. This patch introduces a param variable to limit the size of switches EVRP will process. * gimple-range-edge.cc (gimple_outgoing_range::gimple_outgoing_range): Add parameter to limit size when recognizing switches. (gimple_outgoing_range::edge_range_p): Check size limit. * gimple-range-edge.h (gimple_outgoing_range): Add size field. * gimple-range-gori.cc (gori_map::calculate_gori): Ignore switches that exceed the size limit. (gori_compute::gori_compute): Add initializer. * params.opt (evrp-switch-limit): New. * doc/invoke.texi: Update docs. --- gcc/gimple-range-edge.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/gimple-range-edge.h') diff --git a/gcc/gimple-range-edge.h b/gcc/gimple-range-edge.h index 87b4124..03e8e82 100644 --- a/gcc/gimple-range-edge.h +++ b/gcc/gimple-range-edge.h @@ -38,13 +38,14 @@ along with GCC; see the file COPYING3. If not see class gimple_outgoing_range { public: - gimple_outgoing_range (); + gimple_outgoing_range (int max_sw_edges = INT_MAX); ~gimple_outgoing_range (); gimple *edge_range_p (irange &r, edge e); private: void calc_switch_ranges (gswitch *sw); bool get_edge_range (irange &r, gimple *s, edge e); + int m_max_edges; hash_map *m_edge_table; irange_allocator m_range_allocator; }; -- cgit v1.1