public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106217] New: [11/12/13 Regression] sinking of loads prevents vectorization
@ 2022-07-06 18:19 tnfchris at gcc dot gnu.org
  2022-07-06 20:34 ` [Bug tree-optimization/106217] " pinskia at gcc dot gnu.org
  2022-07-06 21:17 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2022-07-06 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106217
           Summary: [11/12/13 Regression] sinking of loads prevents
                    vectorization
           Product: gcc
           Version: 11.3.1
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---

The following example

void f(int n, float * __restrict x, float *mass, float max, float &ax)
{
    float lax = 0.0f;

    for (int i = 0; i < n; ++i) {
        float f = x[i] * mass[i];
        lax += x[i] >= max ? 0 : f * x[i];
    }

  ax += lax;
  return;
}

vectorizes with GCC 10 with -Ofast but fails starting with GCC 11.
The difference is that in the sink1 pass we now sink the unconditional load of
mass[i] into the conditional.

Sinking # VUSE <.MEM_14(D)>
_7 = *_6;
 from bb 3 to bb 4
Sinking _6 = mass_18(D) + _2;
 from bb 3 to bb 4

consequently this causes if-convert to no longer be able to if-convert the loop
because the load is now conditional, and we only accept unconditional loads in
ifcvt_memrefs_wont_trap.

-------------------------
_6 = mass_18(D) + _2;
-------------------------
_7 = *_6;
tree could trap...

perhaps during the sinking we should mark the load as non-trapping? as it was
originally unconditional anyway.

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

* [Bug tree-optimization/106217] [11/12/13 Regression] sinking of loads prevents vectorization
  2022-07-06 18:19 [Bug tree-optimization/106217] New: [11/12/13 Regression] sinking of loads prevents vectorization tnfchris at gcc dot gnu.org
@ 2022-07-06 20:34 ` pinskia at gcc dot gnu.org
  2022-07-06 21:17 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-06 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-07-06
   Target Milestone|---                         |11.4
                 CC|                            |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Note changing mass[i] to mass[0] will vectorize the loop still as LIM is done
before the first sinking pass (this changed with r7-879-g43c0068e60ad15) and we
don't sink loads into loops.

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

* [Bug tree-optimization/106217] [11/12/13 Regression] sinking of loads prevents vectorization
  2022-07-06 18:19 [Bug tree-optimization/106217] New: [11/12/13 Regression] sinking of loads prevents vectorization tnfchris at gcc dot gnu.org
  2022-07-06 20:34 ` [Bug tree-optimization/106217] " pinskia at gcc dot gnu.org
@ 2022-07-06 21:17 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-06 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 95084.

*** This bug has been marked as a duplicate of bug 95084 ***

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 18:19 [Bug tree-optimization/106217] New: [11/12/13 Regression] sinking of loads prevents vectorization tnfchris at gcc dot gnu.org
2022-07-06 20:34 ` [Bug tree-optimization/106217] " pinskia at gcc dot gnu.org
2022-07-06 21:17 ` pinskia 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).