]> git.ipfire.org Git - thirdparty/gcc.git/commit
emit-rtl: Allow extra checks for paradoxical subregs [PR119966]
authorDimitar Dimitrov <dimitar@dinux.eu>
Sat, 3 May 2025 19:38:30 +0000 (22:38 +0300)
committerDimitar Dimitrov <dimitar@dinux.eu>
Sun, 18 May 2025 18:30:41 +0000 (21:30 +0300)
commiteb2ea476db2182939f585df7d806225649ee4f62
tree63750de9f9ec67416f440fedd407ca1183aedd3a
parent809b46d2ccc9a4a0ab3a5b6015cbe9738b74b0a5
emit-rtl: Allow extra checks for paradoxical subregs [PR119966]

When a paradoxical subreg is detected, validate_subreg exits early, thus
skipping the important checks later in the function.

Fix by continuing with the checks instead of declaring early that the
paradoxical subreg is valid.

One of the newly allowed subsequent checks needed to be disabled for
paradoxical subregs.  It turned out that combine attempts to create
a paradoxical subreg of mem even for strict-alignment targets.
That is invalid and should eventually be rejected, but is
temporarily left allowed to prevent regressions for
armv8l-unknown-linux-gnueabihf.  See PR120329 for more details.

Tests I did:
 - No regressions were found for C and C++ for the following targets:
   - native x86_64-pc-linux-gnu
   - cross riscv64-unknown-linux-gnu
   - cross riscv32-none-elf
 - Sanity checked armv8l-unknown-linux-gnueabihf by cross-building
   up to including libgcc.  Linaro CI bot further confirmed there
   are no regressions.
 - Sanity checked powerpc64-unknown-linux-gnu by building native
   toolchain, but I could not setup qemu-user for DejaGnu testing.

PR target/119966

gcc/ChangeLog:

* emit-rtl.cc (validate_subreg): Do not exit immediately for
paradoxical subregs.  Filter subsequent tests which are
not valid for paradoxical subregs.

Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
gcc/emit-rtl.cc