[llvm] [LV]Fix max safe elements calculations (PR #122148)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 13:08:41 PST 2025
================
@@ -3943,11 +3943,13 @@ FixedScalableVFPair LoopVectorizationCostModel::computeFeasibleMaxVF(
// It is computed by MaxVF * sizeOf(type) * 8, where type is taken from
// the memory accesses that is most restrictive (involved in the smallest
// dependence distance).
- unsigned MaxSafeElements =
- llvm::bit_floor(Legal->getMaxSafeVectorWidthInBits() / WidestType);
+ unsigned MaxSafeElements = Legal->getMaxSafeVectorWidthInBits() / WidestType;
+ if (Legal->isSafeForAnyVectorWidth())
+ MaxSafeElements = bit_ceil(MaxSafeElements);
+ unsigned MaxSafeElementsPowerOf2 = 1ULL << countr_zero(MaxSafeElements);
----------------
alexey-bataev wrote:
Sure
https://github.com/llvm/llvm-project/pull/122148
More information about the llvm-commits
mailing list