aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-edge.cc
AgeCommit message (Collapse)AuthorFilesLines
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-12-06ranger: Add shortcuts for single-successor blocksRichard Sandiford1-0/+3
When compiling an optabs.ii at -O2 with a release-checking build, there were 6,643,575 calls to gimple_outgoing_range_stmt_p. 96.8% of them were for blocks with a single successor, which never have a control statement that generates new range info. This patch therefore adds a shortcut for that case. This gives a ~1% compile-time improvement for the test. I tried making the function inline (in the header) so that the single_succ_p didn't need to be repeated, but it seemed to make things slightly worse. gcc/ * gimple-range-edge.cc (gimple_outgoing_range::edge_range_p): Add a shortcut for blocks with single successors. * gimple-range-gori.cc (gori_map::calculate_gori): Likewise.
2021-10-06Introduce a param-switch-limit for EVRP.Andrew MacLeod1-1/+6
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.
2021-05-07Make TRUE/FALSE edge calculation available without the outgoing edge class.Andrew MacLeod1-11/+20
Rename class to gimple_outoging_edge and provide a non-class routine for the outgoing edge of a gcond. * gimple-range-edge.h (gimple_outgoing_range): Rename from outgoing_range. (gcond_edge_range): Export prototype. * gimple-range-edge.cc (gcond_edge_range): New. (gimple_outgoing_range::edge_range_p): Use gcond_edge_range. * gimple-range-gori.h (gori_compute): Use gimple_outgoing_range.
2021-05-07Don't over-allocate switch default range object.Andrew MacLeod1-4/+4
We were always allocating the 255 max ranges for the default condition. Instead, use int_range_max to build the default range, then allocate and store only what is needed. * gimple-range-edge.cc (outgoing_range::calc_switch_ranges): Compute default range into a temp and allocate only what is needed.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-10-13Do not save hash slots across calls to hash_table::get_or_insert.Aldy Hernandez1-12/+12
There's a read of a freed block while accessing the default_slot in calc_switch_ranges. default_slot->intersect (def_range); It seems the default_slot got swiped from under us, and the valgrind dump indicates the free came from the get_or_insert in the same function: irange *&slot = m_edge_table->get_or_insert (e, &existed); So it looks like the get_or_insert is actually freeing the value of the previously allocated default_slot. Looking down the chain from get_or_insert, we see it calls hash_table<>::expand, which actually does a free while doing a resize of sorts: if (!m_ggc) Allocator <value_type> ::data_free (oentries); else ggc_free (oentries); This patch avoids keeping a pointer to the default_slot across multiple calls to get_or_insert in the loop. gcc/ChangeLog: PR tree-optimization/97379 * gimple-range-edge.cc (outgoing_range::calc_switch_ranges): Do not save hash slot across calls to hash_table<>::get_or_insert.
2020-10-06Ranger classes.Andrew MacLeod1-0/+197
Add the 8 ranger files and the Makefile changes to build it. 2020-10-06 Andrew MacLeod <amacleod@redhat.com> * Makefile.in (OBJS): Add gimple-range*.o. * gimple-range.h: New file. * gimple-range.cc: New file. * gimple-range-cache.h: New file. * gimple-range-cache.cc: New file. * gimple-range-edge.h: New file. * gimple-range-edge.cc: New file. * gimple-range-gori.h: New file. * gimple-range-gori.cc: New file.