[llvm] [SLP]Initial support for (masked)loads + compress and (masked)interleaved (PR #132099)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 04:23:51 PDT 2025
alexey-bataev wrote:
> FWIW, it looks like rewriting this as a loop would make the code slightly simpler:
>
> ```
> @@ -20797,10 +20797,10 @@
> CandidateVFs.push_back(Limit);
> if (VF > MaxTotalNum || VF >= StoresLimit)
> break;
> - for_each(RangeSizes, [&](std::pair<unsigned, unsigned> &P) {
> + for(auto& P : RangeSizes) {
> if (P.first != 0)
> P.first = std::max(P.second, P.first);
> - });
> + }
> // Last attempt to vectorize max number of elements, if all previous
> // attempts were unsuccessful because of the cost issues.
> CandidateVFs.push_back(VF);
> ```
>
> or
>
> ```
> @@ -20797,10 +20797,10 @@
> CandidateVFs.push_back(Limit);
> if (VF > MaxTotalNum || VF >= StoresLimit)
> break;
> - for_each(RangeSizes, [&](std::pair<unsigned, unsigned> &P) {
> + for(std::pair<unsigned, unsigned> &P : RangeSizes) {
> if (P.first != 0)
> P.first = std::max(P.second, P.first);
> - });
> + }
> // Last attempt to vectorize max number of elements, if all previous
> // attempts were unsuccessful because of the cost issues.
> CandidateVFs.push_back(VF);
> ```
>
> And it also makes the crash disappear, though it may be due to the issue being fragile.
Hmm, semantically these 2 pieces are equal. Maybe a bug in the loop vectorizer, that causes memory pollution on data rewriting? Did you compile clang itself with another clang? If so, what is the version?
https://github.com/llvm/llvm-project/pull/132099
More information about the llvm-commits
mailing list