[SLP]Improve costs of vectorized loads/stores by analyzing GEPs.
authorAlexey Bataev <a.bataev@outlook.com>
Tue, 4 Oct 2022 18:14:38 +0000 (11:14 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Thu, 13 Oct 2022 14:20:41 +0000 (07:20 -0700)
commitc787986cddce230e8ca28a773166b5773449bcb9
treeeed21115f64ad3a451c8198ea9b1e04ac3e89657
parentfe755af3a9a56a23494ed231d1b007a9a7b91174
[SLP]Improve costs of vectorized loads/stores by analyzing GEPs.

When generating masked gathers nodes, SLP vectorizer accounts the cost
of the GEPs for loads as part of the scalar-vector transformation cost
estimation. But it does not do it for vectorized loads/stores, while it
may completely remove some of the GEPs completely. Because of this in
some cases masked gather operation can be much more profitable rather
than regular vectorization (masked-gather cost + vector GEP - scalar
loads + GEPs comparing to vectorized loads - scalar loads).
Added the analysis of the removed scalarGEPs for vectorized load/store nodes for better cost estimation.

Differential Revision: https://reviews.llvm.org/D135282
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/remark_horcost.ll
llvm/test/Transforms/SLPVectorizer/X86/remark_not_all_parts.ll