[all-commits] [llvm/llvm-project] 3ad6d1: [LAA] Fix incorrect dependency classification. (#7...

Alexandros Lamprineas via All-commits all-commits at lists.llvm.org
Tue Dec 5 07:27:43 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ad6d1cbe54dc06554303097cc51d590edaa1c1c
      https://github.com/llvm/llvm-project/commit/3ad6d1cbe54dc06554303097cc51d590edaa1c1c
  Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
  Date:   2023-12-05 (Tue, 05 Dec 2023)

  Changed paths:
    M llvm/lib/Analysis/LoopAccessAnalysis.cpp
    M llvm/test/Analysis/LoopAccessAnalysis/forward-negative-step.ll
    A llvm/test/Analysis/LoopAccessAnalysis/print-order.ll

  Log Message:
  -----------
  [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;
}




More information about the All-commits mailing list