aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-03-16 09:27:33 +0000
committerRoger Sayle <roger@nextmovesoftware.com>2022-03-16 09:27:33 +0000
commit6aef670e486e60e9f492752ff25ff3ed6058bc3b (patch)
tree3eff665511e2a06947e16d04fb451ffed84fad8c /gcc/go
parent7690bee9f36ee02b7ad0b8a7e7a3e08357890dc0 (diff)
downloadgcc-6aef670e486e60e9f492752ff25ff3ed6058bc3b.zip
gcc-6aef670e486e60e9f492752ff25ff3ed6058bc3b.tar.gz
gcc-6aef670e486e60e9f492752ff25ff3ed6058bc3b.tar.bz2
Performance/size improvement to single_use when matching GIMPLE.
This patch improves the implementation of single_use as used in code generated from match.pd for patterns using :s. The current implementation contains the logic "has_zero_uses (t) || has_single_use (t)" which performs a loop over the uses to first check if there are zero non-debug uses [which is rare], then another loop over these uses to check if there is exactly one non-debug use. This can be better implemented using a single loop. This function is currently inlined over 800 times in gimple-match.cc, whose .o on x86_64-pc-linux-gnu is now up to 30 Mbytes, so speeding up and shrinking this function should help offset the growth in match.pd for GCC 12. I've also done an analysis of the stage3 sizes of gimple-match.o on x86_64-pc-linux-gnu, which I believe is dominated by debug information, the .o file is 30MB in stage3, but only 4.8M in stage2. Before my proposed patch gimple-match.o is 31385160 bytes. The patch as proposed yesterday (using a single loop in single_use) reduces that to 31105040 bytes, saving 280120 bytes. The suggestion to remove the "inline" keyword saves only 56 more bytes, but annotating ATTRIBUTE_PURE on a function prototype was curiously effective, saving 1888 bytes. before: 31385160 after: 31105040 saved 280120 -inline: 31104984 saved 56 +pure: 31103096 saved 1888 2022-03-16 Roger Sayle <roger@nextmovesoftware.com> Richard Biener <rguenther@suse.de> gcc/ChangeLog * gimple-match-head.cc (single_use): Implement inline using a single loop.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions