[PATCH] rtlanal: fix subreg handling in set_noop_p ()
Richard Sandiford
richard.sandiford@arm.com
Mon Sep 14 10:50:06 GMT 2020
Ilya Leoshkevich <iii@linux.ibm.com> writes:
> Bootstrapped and regtested on x86_64-redhat-linux. Ok for master?
>
>
>
> The following s390 rtx is errneously considered a no-op:
>
> (set (subreg:DF (reg:TF %f0) 8) (subreg:DF (reg:V1TF %f0) 8))
>
> Here, SET_DEST is a second register in a floating-point register pair,
> and SET_SRC is the second half of a vector register, so they refer to
> different bits.
>
> Fix by treating subregs of registers in different modes conservatively.
>
> gcc/ChangeLog:
>
> 2020-09-11 Ilya Leoshkevich <iii@linux.ibm.com>
>
> * rtlanal.c (set_noop_p): Treat subregs of registers in
> different modes conservatively.
> ---
> gcc/rtlanal.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
> index 5ae38b7966d..ed3360562d5 100644
> --- a/gcc/rtlanal.c
> +++ b/gcc/rtlanal.c
> @@ -1619,6 +1619,10 @@ set_noop_p (const_rtx set)
> return 0;
> src = SUBREG_REG (src);
> dst = SUBREG_REG (dst);
> + if (GET_MODE (src) != GET_MODE (dst))
> + /* It is hard to tell whether subregs refers to the same bits, so act
> + * conservatively and return 0. */
Sorry for the nit, but GCC style is not to have leading “*”s on second
and subsequent lines, so just;
/* It is hard to tell whether subregs refers to the same bits, so act
conservatively and return 0. */
OK with that change, thanks.
Richard
> + return 0;
> }
>
> /* It is a NOOP if destination overlaps with selected src vector
More information about the Gcc-patches
mailing list