aboutsummaryrefslogtreecommitdiff
path: root/gcc/output.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-05-30 16:17:58 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2024-05-30 16:17:58 +0100
commit46d931b3dd31cbba7c3355ada63f155aa24a4e2b (patch)
tree72bedb548d20640bdb9c0696659c4cff4338cf42 /gcc/output.h
parent71899d6b4e18145f005046681208db0137c95ede (diff)
downloadgcc-46d931b3dd31cbba7c3355ada63f155aa24a4e2b.zip
gcc-46d931b3dd31cbba7c3355ada63f155aa24a4e2b.tar.gz
gcc-46d931b3dd31cbba7c3355ada63f155aa24a4e2b.tar.bz2
ira: Fix go_through_subreg offset calculation [PR115281]
go_through_subreg used: else if (!can_div_trunc_p (SUBREG_BYTE (x), REGMODE_NATURAL_SIZE (GET_MODE (x)), offset)) to calculate the register offset for a pseudo subreg x. In the blessed days before poly-int, this was: *offset = (SUBREG_BYTE (x) / REGMODE_NATURAL_SIZE (GET_MODE (x))); But I think this is testing the wrong natural size. If we exclude paradoxical subregs (which will get an offset of zero regardless), it's the inner register that is being split, so it should be the inner register's natural size that we use. This matters in the testcase because we have an SFmode lowpart subreg into the last of three variable-sized vectors. The SUBREG_BYTE is therefore equal to the size of two variable-sized vectors. Dividing by the vector size gives a register offset of 2, as expected, but dividing by the size of a scalar FPR would give a variable offset. I think something similar could happen for fixed-size targets if REGMODE_NATURAL_SIZE is different for vectors and integers (say), although that case would trade an ICE for an incorrect offset. gcc/ PR rtl-optimization/115281 * ira-conflicts.cc (go_through_subreg): Use the natural size of the inner mode rather than the outer mode. gcc/testsuite/ PR rtl-optimization/115281 * gfortran.dg/pr115281.f90: New test.
Diffstat (limited to 'gcc/output.h')
0 files changed, 0 insertions, 0 deletions