[llvm] [SLP][REVEC] Disable strided load if the source is vector instruction. (PR #99462)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 04:57:46 PDT 2024
================
@@ -4617,12 +4621,13 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
// 3. The loads are ordered, or number of unordered loads <=
// MaxProfitableUnorderedLoads, or loads are in reversed order.
// (this check is to avoid extra costs for very expensive shuffles).
- if (IsPossibleStrided && (((Sz > MinProfitableStridedLoads ||
- (static_cast<unsigned>(std::abs(*Diff)) <=
- MaxProfitableLoadStride * Sz &&
- isPowerOf2_32(std::abs(*Diff)))) &&
- static_cast<unsigned>(std::abs(*Diff)) > Sz) ||
- *Diff == -(static_cast<int>(Sz) - 1))) {
+ if (IsSourceScalarInstruction && IsPossibleStrided &&
----------------
alexey-bataev wrote:
```suggestion
bool IsPossibleStrided = IsSourceScalarInstruction && (*Diff % (Sz - 1) == 0);
// Try to generate strided load node if:
// 1. Target with strided load support is detected.
// 2. The number of loads is greater than MinProfitableStridedLoads,
// or the potential stride <= MaxProfitableLoadStride and the
// potential stride is power-of-2 (to avoid perf regressions for the very
// small number of loads) and max distance > number of loads, or potential
// stride is -1.
// 3. The loads are ordered, or number of unordered loads <=
// MaxProfitableUnorderedLoads, or loads are in reversed order.
// (this check is to avoid extra costs for very expensive shuffles).
if (IsPossibleStrided &&
```
https://github.com/llvm/llvm-project/pull/99462
More information about the llvm-commits
mailing list