diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-06-10 15:00:44 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-07-02 00:44:44 +0200 |
commit | 1697806fdf25285b924251b0d785324775e9b905 (patch) | |
tree | 3c3b90ec34c64887d7b3adff00dec25c6001a703 /gcc/go | |
parent | 8a6ee426c2be3bd4359520e02c00ec60cac2fece (diff) | |
download | gcc-1697806fdf25285b924251b0d785324775e9b905.zip gcc-1697806fdf25285b924251b0d785324775e9b905.tar.gz gcc-1697806fdf25285b924251b0d785324775e9b905.tar.bz2 |
trailing_wide_ints with runtime variable lengths
Currently global ranges are stored in SSA_NAME_RANGE_INFO as a pair of
wide_int-like objects along with the nonzero bits. We frequently lose
precision when streaming out our higher resolution iranges. The plan
was always to store the full irange between passes. However, as was
originally discussed eons ago:
https://gcc.gnu.org/pipermail/gcc-patches/2017-May/475139.html
...we need a memory efficient way of saving iranges, preferably using
the trailing_wide_ints idiom.
The problem with doing so is that trailing_wide_ints assume a
compile-time specified number of elements. For irange, we need to
determine the size at run-time.
One solution is to adapt trailing_wide_ints such that N is the maximum
number of elements allowed, and allow setting the actual number at
run-time (defaulting to N). The attached patch does this, while
requiring no changes to existing users.
It uses a byte to store the number of elements in the
trailing_wide_ints control word. The control word is currently a
16-bit precision, an 8-bit max-length, and the rest is used for
m_len[N]. On a 64-bit architecture, this allows for 5 elements in
m_len without having to use an extra word. With this patch, m_len[]
would be smaller by one byte (4) before consuming the padding. This
shouldn't be a problem as the only users of trailing_wide_ints use N=2
for NUM_POLY_INT_COEFFS in aarch64, and N=3 for range_info_def.
For irange, my plan is to use one more word to fit a maximum of 12
elements (the above 4 plus 8 more). This would allow for 6 pairs of
sub-ranges which would be more than adequate for our needs. In
previous tests we found that 99% of ranges fit within 3-4 pairs. More
precisely, this would allow for 5 pairs, plus the nonzero bits, plus a
spare wide-int for future development.
Ultimately this means that streaming an irange would consume one more
word than what we currently do for range_info_def. IMO this is a nice
trade-off considering we started storing a slew of wide-ints directly
;-).
Tested and benchmarked on x86-64 Linux. There was no discernible
performance change in our benchmark suite.
gcc/ChangeLog:
* wide-int.h (struct trailing_wide_ints): Add m_num_elements.
(trailing_wide_ints::set_precision): Add num_elements argument.
(trailing_wide_ints::extra_size): Same.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions