Sorry for the slow review.

Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi,
>
> while evaluating another patch that introduces more lvalue paradoxical 
> subregs I ran into an ICE in combine at
>
>         wide_int o = wi::insert (rtx_mode_t (outer, temp_mode),
>                                  rtx_mode_t (inner, dest_mode),
>                                  offset, width);
>
> because width (=GET_MODE_PRECISION (dest_mode)) > GET_MODE_PRECISION 
> (temp_mode).
>
>  From the comments and the code it looks like we do not want to handle a 
> paradoxical subreg here so I quickly added a check for it which prevents 
> the ICE.  The check could also be added to reg_subword_p () I guess.

Yeah, I think adding it to reg_subword_p would be better, immediately
after the GET_CODE (x) == SUBREG test.

OK with that change, thanks.

Richard

>
> Is this the right thing to do or am I missing something, i.e. my other 
> patch might be doing something it should not?
>
> Bootstrap on s390x was successful and testsuite is looking good so far.
>
> Regards
>   Robin
>
> --
>
> gcc/ChangeLog:
>
>          * combine.c (try_combine): Check for paradoxical subreg.
>
> From 2b74c66f8d97c30c45e99336c9871cccd8cf94e1 Mon Sep 17 00:00:00 2001
> From: Robin Dapp <rd...@linux.ibm.com>
> Date: Tue, 22 Jun 2021 17:35:37 +0200
> Subject: [PATCH 11/11] combine paradoxical subreg fix.
>
> ---
>  gcc/combine.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/combine.c b/gcc/combine.c
> index 6476812a212..de04560db21 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -2782,7 +2782,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
> rtx_insn *i0,
>        && CONST_SCALAR_INT_P (SET_SRC (temp_expr))
>        && GET_CODE (PATTERN (i3)) == SET
>        && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3)))
> -      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr)))
> +      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr))
> +      && !paradoxical_subreg_p (SET_DEST (PATTERN (i3))))
>      {
>        rtx dest = SET_DEST (PATTERN (i3));
>        rtx temp_dest = SET_DEST (temp_expr);

Reply via email to