https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127692
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Stefan Schulze Frielinghaus <[email protected]>: https://gcc.gnu.org/g:1de4393ddec6ce2980184f32b0fd428c54d82a20 commit r17-4911-g1de4393ddec6ce2980184f32b0fd428c54d82a20 Author: Stefan Schulze Frielinghaus <[email protected]> Date: Tue Oct 6 08:10:44 2026 +0200 s390: Fix bswap:HI reg-reg splitter [PR127692] The splitter could fire before register allocation for which the attached test ICEs. There we end up for operands[1] with (subreg:HI (reg:HF 70) 0) for which simplify_gen_subreg tries to fold two subregs into (subreg:SI (reg:HF 70) 0) which is invalid. For an invalid simplification NULL_RTX is returned which is just propagated and dereferenced later on leading to an ICE. The splitter is supposed to fire only after register allocation once we decided to go for the GPR alternative in bswaphi2. This also solves the initial problem since after RA we should only deal with hard registers and simplify_gen_subreg folds subregs of GPRs (additionally this solves the problem of using a paradoxical subreg as a left-hand side operand). As a safety net, still test for NULL_RTX which would lead to more descriptive ICEs. PR target/127692 gcc/ChangeLog: * config/s390/s390.md: Fix bswap:HI reg-reg splitter. gcc/testsuite/ChangeLog: * gcc.target/s390/pr127692-1.c: New test. Co-authored-by: Jakub Jelinek <[email protected]>
