llvm-project
llvm-project copied to clipboard
Loop vectorizer always choose Interleave pattern vs Gather and does not vectorize at the end.
| Bugzilla Link | 31426 |
| Version | trunk |
| OS | All |
| CC | @aemerson,@ayalz |
Extended Description
Loop vectorizer cost model for "load" works incorrectly in some cases when the "load" belongs to an interleave group. If interleaving cost is very high, the loop is not vectorized. But some targets allows "gather", that makes loop vectorization profitable. This is the case: for (i=0; i<N; ++i) B[i] = A[i*5]
Stride 5 is higher than maxInterleaveFactor supported by Target, and "Gather" should be taken in this case. But the cost model does not check gathers at all.