public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE
@ 2022-07-21  7:54 linkw at gcc dot gnu.org
  2022-07-21  8:18 ` [Bug tree-optimization/106378] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-07-21  7:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106378
           Summary: Miss to handle ifn .LEN_STORE in DSE
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linkw at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org, rsandifo at gcc dot gnu.org,
                    segher at gcc dot gnu.org
        Depends on: 106365
  Target Milestone: ---
            Target: powerpc*-linux-gnu

+++ This bug was initially created as a clone of Bug #106365 +++

In PR106365, Richi has fixed the miss optimization on {MASK/LEN}_STORE by
teaching VN about these IFNs. But it further exposes one miss optimization in
DSE for LEN_STORE.

With the option -O3 -mcpu=power10 -fno-vect-cost-model, check the optimized
dumpings.

--------------

for the case gcc/testsuite/gcc.dg/tree-ssa/pr84512.c, we expect to get:

int foo ()
{
  <bb 2> [local count: 97603129]:
  return 285;
}

but it gets now:

int foo ()
{
  int a[10];

  <bb 2> [local count: 97603129]:
  .LEN_STORE (&MEM <int[10]> [(void *)&a + 32B], 128B, 8, { 64, 0, 0, 0, 81, 0,
0, 0, 100, 0, 0, 0, 121, 0, 0, 0 }, 0);
  a ={v} {CLOBBER(eol)};
  return 285;

}

--------------

for the case Richi posted:

int __attribute__((noinline,noclone))
foo ()
{
  int out[10];
  int i;
  for (i = 0; i < 10; ++i)
    {
      out[i] = i;
    }
  return out[9];
}

it gets:

__attribute__((noclone, noinline))
int foo ()
{
  int out[10];

  <bb 2> [local count: 97603129]:
  .LEN_STORE (&MEM <int[10]> [(void *)&out + 32B], 128B, 8, { 8, 0, 0, 0, 9, 0,
0, 0, 10, 0, 0, 0, 11, 0, 0, 0 }, 0);
  out ={v} {CLOBBER(eol)};
  return 9;

}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106365
[Bug 106365] Miss to handle ifn .LEN_STORE in FRE

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
@ 2022-07-21  8:18 ` rguenth at gcc dot gnu.org
  2022-07-21  8:18 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-21  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-07-21

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
  2022-07-21  8:18 ` [Bug tree-optimization/106378] " rguenth at gcc dot gnu.org
@ 2022-07-21  8:18 ` rguenth at gcc dot gnu.org
  2022-07-21  8:28 ` linkw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-21  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 53330
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53330&action=edit
patch

I am testing this on x86_64-linux.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
  2022-07-21  8:18 ` [Bug tree-optimization/106378] " rguenth at gcc dot gnu.org
  2022-07-21  8:18 ` rguenth at gcc dot gnu.org
@ 2022-07-21  8:28 ` linkw at gcc dot gnu.org
  2022-07-21 11:06 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-07-21  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Created attachment 53330 [details]
> patch
> 
> I am testing this on x86_64-linux.

I confirmed this attachment can make two case above to get expected optimized
IRs on Power10.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-07-21  8:28 ` linkw at gcc dot gnu.org
@ 2022-07-21 11:06 ` cvs-commit at gcc dot gnu.org
  2022-07-21 11:24 ` rguenth at gcc dot gnu.org
  2022-07-21 11:24 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-21 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:dc477ffb4aba21e9cf47de22a4df6f2b23849505

commit r13-1778-gdc477ffb4aba21e9cf47de22a4df6f2b23849505
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jul 21 10:13:46 2022 +0200

    tree-optimization/106378 - DSE of LEN_STORE and MASK_STORE

    The following enhances DSE to handle LEN_STORE (optimally) and
    MASK_STORE (conservatively).

            PR tree-optimization/106378
            * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Handle
            LEN_STORE, add mode to initialize a may-def and handle
            MASK_STORE that way.
            (dse_optimize_stmt): Query may-defs.  Handle internal
            functions LEN_STORE and MASK_STORE similar to how
            we handle memory builtins but without byte tracking.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-07-21 11:06 ` cvs-commit at gcc dot gnu.org
@ 2022-07-21 11:24 ` rguenth at gcc dot gnu.org
  2022-07-21 11:24 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-21 11:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/106378] Miss to handle ifn .LEN_STORE in DSE
  2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-21 11:24 ` rguenth at gcc dot gnu.org
@ 2022-07-21 11:24 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-21 11:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106378
Bug 106378 depends on bug 106365, which changed state.

Bug 106365 Summary: Miss to handle ifn .LEN_STORE in FRE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106365

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-21 11:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  7:54 [Bug tree-optimization/106378] New: Miss to handle ifn .LEN_STORE in DSE linkw at gcc dot gnu.org
2022-07-21  8:18 ` [Bug tree-optimization/106378] " rguenth at gcc dot gnu.org
2022-07-21  8:18 ` rguenth at gcc dot gnu.org
2022-07-21  8:28 ` linkw at gcc dot gnu.org
2022-07-21 11:06 ` cvs-commit at gcc dot gnu.org
2022-07-21 11:24 ` rguenth at gcc dot gnu.org
2022-07-21 11:24 ` rguenth at gcc dot gnu.org

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).