On Wed, 15 Jul 2026, John Paul Adrian Glaubitz wrote:
> The actual patch is rather simple:
>
> --- a/gcc/lra-constraints.cc
> +++ b/gcc/lra-constraints.cc
> @@ -694,14 +694,16 @@ get_matching_reload_reg_subreg (machine_mode mode, rtx
> reg,
> enum reg_class rclass)
> {
> int hard_regno = ira_class_hard_regs[rclass][0];
> + rtx res;
> if (subreg_regno_offset (hard_regno,
> GET_MODE (reg),
> subreg_lowpart_offset (mode, GET_MODE (reg)),
> - mode) == 0)
> + mode) == 0
> + && (res = lowpart_subreg (mode, reg, GET_MODE (reg))) != NULL_RTX)
> /* For matching scalar int modes generate the right subreg byte offset
> for
> BE targets -- see call of reload.cc:operands_match_p in
> recog.cc:constrain_operands. */
> - return lowpart_subreg (mode, reg, GET_MODE (reg));
> + return res;
I'd suggest to trivially avoid using an assignment in a conditional, as
it can be confusing to the reader. Sometimes it makes a simple piece of
code complex, in which case the assignment might be the lesser evil, but
it does not appear to be the case here.
Maciej