GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
s390

s390: Fix bswap:HI reg-reg splitter to avoid ICE

Fixes a compiler ICE on s390 by ensuring the bswap:HI reg-reg splitter only runs after register allocation.

A compiler internal error (ICE) on s390 occurred because the bswap:HI reg-reg splitter was incorrectly firing before register allocation. This led to invalid subregister operations that simplified_gen_subreg could not handle, resulting in NULL_RTX and a crash. The fix ensures the splitter runs only after register allocation, when it operates on hard registers and avoids paradoxical subreg issues, while also adding a safety check for NULL_RTX.

In Details

The bswap:HI reg-reg splitter in s390.md was being invoked too early, before register allocation. This resulted in a situation where simplify_gen_subreg attempted to fold invalid subregisters (e.g., (subreg:HI (reg:HF 70) 0)) leading to NULL_RTX and an ICE. The fix restricts the splitter's invocation to the post-register allocation phase, ensuring it operates on valid hard registers and resolves paradoxical subreg issues.

For Context
s390
IBM's mainframe computer architecture, also implemented in Linux on IBM Z systems.
ICE
Internal Compiler Error; a crash within the compiler itself, usually indicating a bug in the compiler's logic.
splitter
A piece of compiler code responsible for breaking down complex instructions or operations into smaller, simpler ones that can be more easily handled by subsequent optimization passes or code generation.
register allocation
The compiler phase that assigns program variables and intermediate values to the limited number of hardware registers available on the CPU.
subreg
A subregister, which refers to a portion of a larger hardware register. For example, the lower 16 bits of a 32-bit register.
Filed Under: s390compiler bugICEregister allocation