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

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