GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
regcprop

regcprop: Guard subreg_lowpart_offset with ordered_p

Prevents compiler ICEs on RISC-V by ensuring mode sizes are ordered before calling subreg_lowpart_offset.

This commit resolves compiler internal errors (ICEs) occurring on RISC-V with higher LMULs, specifically when dealing with vector dot-product operations. The subreg_lowpart_offset function requires that mode sizes be ordered, but it was being called with unordered modes in certain scenarios. The fix adds a check to ensure mode sizes are ordered before calling this function, preventing the ICEs.

In Details

The copyprop_hardreg_forward_1 function in regcprop.cc was calling subreg_lowpart_offset with modes that did not satisfy the ordered_p requirement. This condition arises with vector operations (like dot-products) on RISC-V using higher LMULs. The patch adds an ordered_p check to copyprop_hardreg_forward_1 to guard the call to subreg_lowpart_offset, preventing ICEs.

For Context
regcprop
Register copy propagation, a compiler optimization pass that replaces register copies with direct uses of the source register.
ICE
Internal Compiler Error, a condition where the compiler encounters an unrecoverable internal fault and terminates.
LMUL
Vector Length Multiplier, a parameter in RISC-V vector extensions that scales the vector register length.
mode sizes
Refers to the size of data types or registers as represented internally by the compiler. In this context, it likely relates to the sizes of vector elements or registers.
Filed Under: regcproprisc-voptimizationcompiler error