]> gcc.gnu.org Git - gcc.git/commit
aarch64: Don't assert recog success in ldp/stp pass [PR113114]
authorAlex Coplan <alex.coplan@arm.com>
Thu, 18 Jan 2024 17:53:01 +0000 (17:53 +0000)
committerAlex Coplan <alex.coplan@arm.com>
Tue, 23 Jan 2024 10:57:33 +0000 (10:57 +0000)
commit20e18106fac2d11ee43683291ff11d76da41d50b
tree674ad2da10260e8cf42f9b6db89cdad8fbcf9623
parentbd1703b79c14331ce4d894ac0432db5e098b6244
aarch64: Don't assert recog success in ldp/stp pass [PR113114]

The PR shows two different cases where try_promote_writeback produces an
RTL pattern which isn't recognized.  Currently this leads to an ICE, as
we assert recog success, but I think it's better just to back out of the
changes gracefully if recog fails (as we do in the main fuse_pair case).

In theory since we check the ranges here recog shouldn't fail (which is
why I had the assert in the first place), but the PR shows an edge case
in the patterns where if we form a pre-writeback pair where the
writeback offset is exactly -S, where S is the size in bytes of one
transfer register, we fail to match the expected pattern as the patterns
look explicitly for plus operands in the mems.  I think fixing this
would require adding at least four new special-case patterns to
aarch64.md for what doesn't seem to be a particularly useful variant of
the insns.  Even if we were to do that, I think it would be GCC 15
material, and it's better to just punt for GCC 14.

The ILP32 case in the PR is a bit different, as that shows us trying to
combine a pair with DImode base register operands in the mems together
with an SImode trailing update of the base register.  This leads to us
forming an RTL pattern which references the base register in both SImode
and DImode, which also fails to recog.  Again, I think it's best just to
take the missed optimization for now.  If we really want to make this
(try_promote_writeback) work for ILP32, we can try to do it for GCC 15.

gcc/ChangeLog:

PR target/113114
* config/aarch64/aarch64-ldp-fusion.cc (try_promote_writeback):
Don't assert recog success, just punt if the writeback pair
isn't recognized.

gcc/testsuite/ChangeLog:

PR target/113114
* gcc.c-torture/compile/pr113114.c: New test.
* gcc.target/aarch64/pr113114.c: New test.
gcc/config/aarch64/aarch64-ldp-fusion.cc
gcc/testsuite/gcc.c-torture/compile/pr113114.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/pr113114.c [new file with mode: 0644]
This page took 0.06032 seconds and 6 git commands to generate.