rtl: Validate subreg info when optimizing vec_select.

When optimizing for NOPs in case of overlapping regs in VEC_SELECT expressions,
validate subreg data before using simplify_subreg_regno.  There is no real
SUBREG rtx here, but a pseudo subreg call to check if subregs are possible.

gcc/ChangeLog:

	* rtlanal.cc (set_noop_p): Validate subreg constraints before checking
	for overlapping regs using simplify_subreg_regno.
This commit is contained in:
Tejas Belagod 2024-09-02 20:53:42 +05:30
parent 9a62c14958
commit a552a808f0

View File

@ -1686,6 +1686,7 @@ set_noop_p (const_rtx set)
} }
return return
REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst)) REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst))
&& validate_subreg (GET_MODE (dst), GET_MODE (src0), src0, offset)
&& simplify_subreg_regno (REGNO (src0), GET_MODE (src0), && simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
offset, GET_MODE (dst)) == (int) REGNO (dst); offset, GET_MODE (dst)) == (int) REGNO (dst);
} }