public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104917] New: No runtime alias test required for dependent reductions
@ 2022-03-14 13:51 rguenth at gcc dot gnu.org
  2022-03-15  9:12 ` [Bug tree-optimization/104917] " jakub at gcc dot gnu.org
  2022-03-15  9:21 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-14 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104917
           Summary: No runtime alias test required for dependent
                    reductions
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

The testcase from PR87561 shows a case where we have two in-memory reductions
that are possibly dependent but the runtime alias check isn't needed since
we only possibly re-order the summations in the reduction.  Small C testcase:

void foo (double *x, double *y, double * __restrict a, double * __restrict b)
{
  for (int i = 0; i < 1024; ++i)
    {
      x[i] += a[i];
      y[i] += b[i];
    }
}

here x[] and y[] are dependent but we can vectorize this just fine with
-fassociative-math, eliding the runtime alias check.

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

* [Bug tree-optimization/104917] No runtime alias test required for dependent reductions
  2022-03-14 13:51 [Bug tree-optimization/104917] New: No runtime alias test required for dependent reductions rguenth at gcc dot gnu.org
@ 2022-03-15  9:12 ` jakub at gcc dot gnu.org
  2022-03-15  9:21 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-15  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What if x = y + 1 or y = x + 1 ?

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

* [Bug tree-optimization/104917] No runtime alias test required for dependent reductions
  2022-03-14 13:51 [Bug tree-optimization/104917] New: No runtime alias test required for dependent reductions rguenth at gcc dot gnu.org
  2022-03-15  9:12 ` [Bug tree-optimization/104917] " jakub at gcc dot gnu.org
@ 2022-03-15  9:21 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-15  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> What if x = y + 1 or y = x + 1 ?

We then do

  (y+1)[i] += a[i];
  (y+1)[i+1] += a[i+1];
  y[i] += a[i];
  y[i+1] += a[i+1];

instead of

  (y+1)[i] += a[i];
  y[i] += a[i];
  (y+1)[i+1] += a[i+1];
  y[i+1] += a[i+1];

which should be OK if re-associating the adds to y[i+1] is OK.

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

end of thread, other threads:[~2022-03-15  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 13:51 [Bug tree-optimization/104917] New: No runtime alias test required for dependent reductions rguenth at gcc dot gnu.org
2022-03-15  9:12 ` [Bug tree-optimization/104917] " jakub at gcc dot gnu.org
2022-03-15  9:21 ` 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).