public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] [RFC] vect: Fix infinite loop while determining peeling amount
Date: Mon, 27 Jul 2020 09:06:04 +0200	[thread overview]
Message-ID: <CAFiYyc0bBU808uES5SyDPS_HtmbRP2+YDsJQQ=c=Pf6-gsAxWA@mail.gmail.com> (raw)
In-Reply-To: <20200722151450.1540130-1-stefansf@linux.ibm.com>

On Wed, Jul 22, 2020 at 5:18 PM Stefan Schulze Frielinghaus via
Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> This is a follow up to commit 5c9669a0e6c respectively discussion
> https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549132.html
>
> In case that an alignment constraint is less than the size of a
> corresponding scalar type, ensure that we advance at least by one
> iteration.  For example, on s390x we have for a long double an alignment
> constraint of 8 bytes whereas the size is 16 bytes.  Therefore,
> TARGET_ALIGN / DR_SIZE equals zero resulting in an infinite loop which
> can be reproduced by the following MWE:

But we guard this case with vector_alignment_reachable_p, so we shouldn't
have ended up here and the patch looks bogus.

Richard.

> extern long double *a;
> extern double *b;
> void fun(void) {
>   for (int i = 0; i < 42; i++)
>     a[i] = b[i];
> }
>
> Increasing the number of peelings in each iteration at least by one
> fixes the issue for me.  Any comments?
>
> Bootstrapped and regtested on s390x.
>
> gcc/ChangeLog:
>
>         * tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
>         Ensure that loop variable npeel_tmp advances in each iteration.
> ---
>  gcc/tree-vect-data-refs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
> index e35a215e042..a78ae61d1b0 100644
> --- a/gcc/tree-vect-data-refs.c
> +++ b/gcc/tree-vect-data-refs.c
> @@ -1779,7 +1779,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
>                  {
>                    vect_peeling_hash_insert (&peeling_htab, loop_vinfo,
>                                             dr_info, npeel_tmp);
> -                 npeel_tmp += target_align / dr_size;
> +                 npeel_tmp += MAX (1, target_align / dr_size);
>                  }
>
>               one_misalignment_known = true;
> --
> 2.25.3
>

  parent reply	other threads:[~2020-07-27  7:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 15:14 Stefan Schulze Frielinghaus
2020-07-24 15:54 ` Richard Sandiford
2020-07-27  7:06 ` Richard Biener [this message]
2020-07-27  8:41   ` Richard Sandiford
2020-07-27  9:12     ` Richard Biener
2020-07-27  9:45       ` Richard Sandiford
2020-07-27 10:29         ` Richard Biener
2020-07-27 14:20           ` Stefan Schulze Frielinghaus
2020-07-28  6:55             ` Richard Biener
2020-07-28 15:36               ` Stefan Schulze Frielinghaus
2020-07-29  7:11                 ` Richard Biener
2020-07-29  7:49                   ` Stefan Schulze Frielinghaus
2020-07-29  8:06                     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc0bBU808uES5SyDPS_HtmbRP2+YDsJQQ=c=Pf6-gsAxWA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=stefansf@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).