3 Commits

Author SHA1 Message Date
Alexandros Lamprineas
3ad6d1cbe5
[LAA] Fix incorrect dependency classification. (#70819)
As shown in #70473, the following loop was not considered safe to
vectorize. When determining the memory access dependencies in
a loop which has negative iteration step, we invert the source and
sink of the dependence. Perhaps we should just invert the operands
to getMinusSCEV(). This way the dependency is not regarded to be
true, since the users of the `IsWrite` variables, which correspond to
each of the memory accesses, rely on program order and therefore
should not be swapped.

void vectorizable_Read_Write(int *A) {
  for (unsigned i = 1022; i >= 0; i--)
    A[i+1] = A[i] + 1;
}
2023-12-05 15:27:30 +00:00
Florian Hahn
5d353423c9
[LAA] Add extra test for #70819 showing incorrect Forward dep.
Add an additional test case where we currently incorrectly identify a
dependence as Foward instead of ForwardButPreventsForwarding.

Also cleans up the names in the tests a bit to improve readability.
2023-11-20 11:18:13 +00:00
Alexandros Lamprineas
7d21d7395c
[LAA] Add a test case to show incorrect dependency classification (NFC). (#70473)
Currently the loop access analysis classifies this loop as unsafe to
vectorize because the memory dependencies are
'ForwardButPreventsForwarding'. However, the access pattern is
'write-after-read' with no subsequent read accessing the written memory
locations. I can't see how store-to-load forwarding is applicable here.

void vectorizable_Read_Write(int *A) {
  for (unsigned i = 1022; i >= 0; i--)
    A[i+1] = A[i] + 1;
}
2023-10-31 15:01:28 +00:00