diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2024-08-29 14:00:23 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2024-08-29 14:00:23 +0100 |
commit | ac6d433b02ce26a646b2a7254b1d87fcc06b0beb (patch) | |
tree | 9398a53d9997c035ca33d2b1f80b197ca083c533 /gcc/gimple-loop-jam.cc | |
parent | 00ec6bd805924b2d7d72cf03b200b3b4b7831835 (diff) | |
download | gcc-ac6d433b02ce26a646b2a7254b1d87fcc06b0beb.zip gcc-ac6d433b02ce26a646b2a7254b1d87fcc06b0beb.tar.gz gcc-ac6d433b02ce26a646b2a7254b1d87fcc06b0beb.tar.bz2 |
Allow subregs around constant displacements [PR116516]
This patch fixes a regression introduced by g:708ee71808ea61758e73.
x86_64 allows addresses of the form:
(zero_extend:DI (subreg:SI (symbol_ref:DI "foo") 0))
Before the previous patch, a lax SUBREG check meant that we would
treat the subreg as a base and reload it into a base register.
But that wasn't what the target was expecting. Instead we should
treat "foo" as a constant displacement, to match:
leal foo, <dest>
After the patch, we recognised that "foo" isn't a base register,
but ICEd on it rather than handling it as a displacement.
With or without the recent patches, if the address had instead been:
(zero_extend:DI
(subreg:SI (plus:DI (reg:DI R) (symbol_ref:DI "foo") 0)))
then we would have treated "foo" as the displacement and R as the base
or index, as expected. The problem was that the code that does this was
rejecting all subregs of objects, rather than just subregs of variable
objects.
gcc/
PR middle-end/116516
* rtlanal.cc (strip_address_mutations): Allow subregs around
constant displacements.
gcc/testsuite/
PR middle-end/116516
* gcc.c-torture/compile/pr116516.c: New test.
Diffstat (limited to 'gcc/gimple-loop-jam.cc')
0 files changed, 0 insertions, 0 deletions