Thanks Robin.

> This seems a bit counter-intuitive and I would rather see the subreg in 
> the constraint function

Not sure if my understanding about this correct but it seems there are more 
than one place taking care the subreg in lRA.

process_alt_operands
  - op = no_subreg_reg_operand[nop];
  - mode = curr_operand_mode[nop];

get_dependent_filter
  -   rtx ref_op = *curr_id->operand_loc[ref_opno];
  -   if (SUBREG_P (ref_op))
  -      ref_op = SUBREG_REG (ref_op);

process_dependent_filters:
  -   rtx op = *curr_id->operand_loc[i];
  -   if (!REG_P (op) || HARD_REGISTER_P (op))
  -     continue;

> .  Going to have a look, but after Cauldron.

Sure thing, take your time.

Pan

-----Original Message-----
From: Robin Dapp <[email protected]> 
Sent: Wednesday, September 30, 2026 3:49 PM
To: Li, Pan2 <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; 
[email protected]; Chen, Ken <[email protected]>; Liu, Hongtao 
<[email protected]>
Subject: Re: [PATCH v1 3/4] RISC-V: Fix ICE for vfw{add,sub}.wv when vs1 is 
subreg of vd

> From: Pan Li <[email protected]>
>
> The function riscv_v_widen_non_overlap_constraint_ok returns false
> when the mode of the register is the same as the reference one.  But
> the LRA takes the inner reg of the subreg as the reference register,
> for example the vs1 of the vfwsub.wv comes from the vget of the vd
> register group as below.
>
>   (minus:RVVM4DF (reg/v:RVVM4DF 151)
>     (float_extend:RVVM4DF (subreg:RVVM2SF (reg/v:RVVM4DF 139) [32, 32])))
>
> Then the vs2 in RVVM4DF will always be rejected by the Wn4 constraint
> because the reference mode is RVVM4DF as well, and result in the ICE
> as below.
>
>   during RTL pass: reload
>   internal compiler error: in lra_split_hard_reg_for, at
>   lra-assigns.cc:1908
>
> Thus, remove the mode check and only take the register group overlap
> into account for the non-overlap constraint.

This seems a bit counter-intuitive and I would rather see the subreg in 
the constraint function.  Maybe I'm passing the wrong reg somewhere in 
lra?  My guess is the subreg handling is inconsistent.  Going to have a 
look, but after Cauldron.

-- 
Regards
 Robin

Reply via email to