public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5811] ranger: Add shortcuts for single-successor blocks
@ 2021-12-06 18:29 Richard Sandiford
0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2021-12-06 18:29 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:63c59f054a5cd6d356ad8bce79182ab205b7aa43
commit r12-5811-g63c59f054a5cd6d356ad8bce79182ab205b7aa43
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Mon Dec 6 18:29:31 2021 +0000
ranger: Add shortcuts for single-successor blocks
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.
Diff:
---
gcc/gimple-range-edge.cc | 3 +++
gcc/gimple-range-gori.cc | 3 +++
2 files changed, 6 insertions(+)
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index afffc8dbcae..9e805230004 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -182,6 +182,9 @@ gimple_outgoing_range::calc_switch_ranges (gswitch *sw)
gimple *
gimple_outgoing_range::edge_range_p (irange &r, edge e)
{
+ if (single_succ_p (e->src))
+ return NULL;
+
// Determine if there is an outgoing edge.
gimple *s = gimple_outgoing_range_stmt_p (e->src);
if (!s)
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 6c17267ad37..8691abab443 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -555,6 +555,9 @@ gori_map::calculate_gori (basic_block bb)
m_outgoing[bb->index] = BITMAP_ALLOC (&m_bitmaps);
m_incoming[bb->index] = BITMAP_ALLOC (&m_bitmaps);
+ if (single_succ_p (bb))
+ return;
+
// If this block's last statement may generate range informaiton, go
// calculate it.
gimple *stmt = gimple_outgoing_range_stmt_p (bb);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-06 18:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 18:29 [gcc r12-5811] ranger: Add shortcuts for single-successor blocks Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).