llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Same phi is calculated twice and not optimized away

Open komalon1 opened this issue 3 years ago • 2 comments

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.

komalon1 avatar Aug 28 '23 14:08 komalon1

It has been handled by newgvn. https://godbolt.org/z/x4e9jffqn

dtcxzyw avatar Dec 13 '23 20:12 dtcxzyw

NewGVN is not enabled by default (and I think not close to that either), so we should probably seep the issue open

fhahn avatar Dec 13 '23 20:12 fhahn