public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Adonis Ling <adonis0147@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Why does different types of array subscript used to iterate affect auto vectorization
Date: Tue, 28 Jun 2022 18:38:25 +0300 (MSK)	[thread overview]
Message-ID: <3b44a272-447c-28d7-678d-5968df7ec248@ispras.ru> (raw)
In-Reply-To: <CAG5qfXi-jE1wtgsKBECR88R8c6FhnWBP3Dj07eTv5d6g4fZHYQ@mail.gmail.com>

On Tue, 28 Jun 2022, Adonis Ling via Gcc-help wrote:

> > Here the main problem is '*array' and 'nread' have the same type, so they
> > might overlap. Ideally the compiler would recognize that that cannot happen
> > because it would make 'array[nread++] = i' undefined due to unsequenced
> > modifications, but GCC is not sufficiently smart (yet). The secondary issue
> > is the same as below:
> >
> 
> I got your point.
> 
> After that, I tried to add __restrict__ to nread as the following shows and
> GCC still doesn't optimize it.

As I said, there's a secondary issue even if you add 'restrict'.

Alexander

  reply	other threads:[~2022-06-28 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  2:47 Adonis Ling
2022-06-28 13:06 ` Alexander Monakov
2022-06-28 15:23   ` Adonis Ling
2022-06-28 15:38     ` Alexander Monakov [this message]
2022-06-28 15:47       ` Adonis Ling
2022-06-28 15:56         ` Alexander Monakov
2022-06-28 16:00           ` Adonis Ling

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=3b44a272-447c-28d7-678d-5968df7ec248@ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=adonis0147@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).