public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106989] GCC fail to vectorize and clang succeed
Date: Wed, 21 Sep 2022 08:11:51 +0000	[thread overview]
Message-ID: <bug-106989-4-T9QudoM7OA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106989-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106989

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-09-21
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to JuzheZhong from comment #4)
> (In reply to Andrew Pinski from comment #3)
> > The DSE happens but only at the RTL level ....
> 
> Is it a good idea to do data-ref in DSE and remove the first redundant store?

Probably - of course that makes things more expensive.  The case at hand
can probably be handled by what LIMs mem_refs_may_alias_p does, using

  get_inner_reference_aff (mem1->mem.ref, &off1, &size1);
  get_inner_reference_aff (mem2->mem.ref, &off2, &size2);
  aff_combination_expand (&off1, ttae_cache);
  aff_combination_expand (&off2, ttae_cache);
  aff_combination_scale (&off1, -1);
  aff_combination_add (&off2, &off1);

  if (aff_comb_cannot_overlap_p (&off2, size1, size2))
    return false;

but I'm not sure we should add more code doing things like that ...

If we think that firing up dataref analysis at the point we discover the
possible use is too expensive we could also optimistically queue them
and only when we find a killing def (and thus the store would be dead),
process the queued uses, checking them if they are really important.

But well, maybe just try the simplest approach and measure the compile-time
effect.  That is, in

          /* If the statement is a use the store is not dead.  */
          else if (ref_maybe_used_by_stmt_p (use_stmt, ref))
            {
              /* Handle common cases where we can easily build an ao_ref
                 structure for USE_STMT and in doing so we find that the
                 references hit non-live bytes and thus can be ignored.

for a gimple assignment, check dr_may_alias_p after analyzing both
stmts (we can of course at least cache the DR for 'stmt').  Guarded
with flag_expensive_optimizations (thus -O2+).  You also need to then
initialize loops and SCEV.

  parent reply	other threads:[~2022-09-21  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 23:05 [Bug c/106989] New: " juzhe.zhong at rivai dot ai
2022-09-20 23:21 ` [Bug tree-optimization/106989] " pinskia at gcc dot gnu.org
2022-09-20 23:46 ` crazylht at gmail dot com
2022-09-21  0:42 ` pinskia at gcc dot gnu.org
2022-09-21  0:45 ` pinskia at gcc dot gnu.org
2022-09-21  0:50 ` juzhe.zhong at rivai dot ai
2022-09-21  8:11 ` rguenth at gcc dot gnu.org [this message]
2022-09-22 15:56 ` pinskia at gcc dot gnu.org

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=bug-106989-4-T9QudoM7OA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).