llvm-project
llvm-project copied to clipboard
[GVN] Incorrect non-local load elimination
Attached test case demonstrates incorrect 'non-local' load elimination. Basically, test does following:
for (i = ... ) {
array[2] += i;
array[3] += i;
array[3] *= -1802;
array[2] += i;
array[3] += i;
}
but with fancy CFG (and this fancy CFG is required to reproduce issue).
LLVM vectorizes increments of array[2:3] and then GVN removes second vector load not noticing that array[3] element was
updated between two loads.
(See BB latch where load %val.array.2_3.3 is eliminated)
gvn_nonlocal_dep.txt
Attached test renamed to .txt from .ll