diff options
author | Florian Hahn <flo@fhahn.com> | 2025-04-12 20:05:37 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2025-04-12 20:05:37 +0100 |
commit | 995fd47944f471e985e34d7da8c0667059decbac (patch) | |
tree | dc8e08626de3f259e9612b4d8865c564f42a9fee /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | b71123f1272ee081b18b8ced1925d6e9300e7310 (diff) | |
download | llvm-995fd47944f471e985e34d7da8c0667059decbac.zip llvm-995fd47944f471e985e34d7da8c0667059decbac.tar.gz llvm-995fd47944f471e985e34d7da8c0667059decbac.tar.bz2 |
[LAA] Make sure MaxVF for Store-Load forward safe dep distances is pow2.
MaxVF computed in couldPreventStoreLoadFowrard may not be a power of 2,
as CommonStride may not be a power-of-2.
This can cause crashes after 78777a20. Use bit_floor to make sure it is
a suitable power-of-2.
Fixes https://github.com/llvm/llvm-project/issues/134696.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index a37ed5c..0cb1332 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -1781,7 +1781,8 @@ bool MemoryDepChecker::couldPreventStoreLoadForward(uint64_t Distance, MaxStoreLoadForwardSafeDistanceInBits && MaxVFWithoutSLForwardIssuesPowerOf2 != VectorizerParams::MaxVectorWidth * TypeByteSize) { - uint64_t MaxVF = MaxVFWithoutSLForwardIssuesPowerOf2 / CommonStride; + uint64_t MaxVF = + bit_floor(MaxVFWithoutSLForwardIssuesPowerOf2 / CommonStride); uint64_t MaxVFInBits = MaxVF * TypeByteSize * 8; MaxStoreLoadForwardSafeDistanceInBits = std::min(MaxStoreLoadForwardSafeDistanceInBits, MaxVFInBits); |