llvm-project
llvm-project copied to clipboard
Same phi is calculated twice and not optimized away
look at reproducer at https://godbolt.org/z/575on875q.
short tmp = 0;
short tmp2 = 0;
#pragma clang loop vectorize(disable)
#pragma nounroll
for(int x=0; x<width; x++) {
tmp += in1[x];
tmp2 += in1[x];
}
even though tmp and tmp2 compute the same values, in the resulting IR there are 2 phi instructions calculating the exact same value.
It has been handled by newgvn.
https://godbolt.org/z/x4e9jffqn
NewGVN is not enabled by default (and I think not close to that either), so we should probably seep the issue open