This patch enable the vectorization of backward dependence. For
example:
for (int i = 0; i < n; i++) {
a[i] = c[i] * 2;
b[i] = a[i + 1] + 1;
}
for (int i = 0; i < n; i++) {
a[i] = c[i] * 2;
a[i + 1] = b[i] + 1;
}
// When compiled with -force-vector-width=4, before this patch it
// is not vectorizable.
for (int i = 0; i < n; i++) {
c[i] = a[i] * 2;
a[i + 2] = b[i] + 1;
}The MemoryDepChecker does analysis without reordering accesses,
while this patch appends checking on the unsafe dependences with
reordering accesses.
Tested on AArch64 and x86_64 Linux.
clang-format: please reformat the code