[PATCH, rs6000] Add additional checks when identifying load/store instructions

Segher Boessenkool segher@kernel.crashing.org
Fri Aug 6 15:02:50 GMT 2021


On Fri, Aug 06, 2021 at 09:47:40AM -0500, Pat Haugen wrote:
> Add additional checks to verify destination[source] of a load[store]
> instruction is a register.

> 	* config/rs6000/rs6000.c: (is_load_insn1): Verify destination is a
> 	register.

No colon before " (".

> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -18357,7 +18361,7 @@ is_load_insn1 (rtx pat, rtx *load_mem)
>    if (!pat || pat == NULL_RTX)
>      return false;
>  
> -  if (GET_CODE (pat) == SET)
> +  if (GET_CODE (pat) == SET && REG_P (SET_DEST (pat)))
>      return find_mem_ref (SET_SRC (pat), load_mem);

So this now falls through if it is a SET of something else than a reg.
Is that intentional?  If so, this should be in the changelog.

> @@ -18394,7 +18398,8 @@ is_store_insn1 (rtx pat, rtx *str_mem)
>    if (!pat || pat == NULL_RTX)
>      return false;
>  
> -  if (GET_CODE (pat) == SET)
> +  if (GET_CODE (pat) == SET
> +      && (REG_P (SET_SRC (pat)) || SUBREG_P (SET_SRC (pat))))
>      return find_mem_ref (SET_DEST (pat), str_mem);

Similar here.


Segher


More information about the Gcc-patches mailing list