Bug 89908 - Unnecessary rejection of dependence for outer loop vectorisation
Summary: Unnecessary rejection of dependence for outer loop vectorisation
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2019-04-01 17:23 UTC by Richard Sandiford
Modified: 2019-04-03 08:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-04-03 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sandiford 2019-04-01 17:23:52 UTC
This loop:

void __attribute__ ((noipa))
f (int a[][N], int b[restrict])
{
  for (int i = N - 1; i-- > 0; )
    for (int j = 0; j < N - 1; ++j)
      a[j + 1][i] = a[j][i + 1] + b[i];
}

should be vectorisable using outer loop vectorisation, since the
dependence between the lhs and rhs is in the same nonzero direction
for both loops.

See https://gcc.gnu.org/ml/gcc-patches/2019-03/msg01224.html for
some discussion about how the dependence checks could be handled.
Comment 1 Richard Biener 2019-04-03 08:53:43 UTC
Confirmed.