[SLP]Fix write after bounds.
authorAlexey Bataev <a.bataev@outlook.com>
Thu, 3 Nov 2022 12:30:41 +0000 (05:30 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Thu, 3 Nov 2022 12:30:41 +0000 (05:30 -0700)
Need to use comma instead of + symbol to prevent writing after bounds.

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index 8a44c4d..f874cfc 100644 (file)
@@ -4020,7 +4020,7 @@ void BoUpSLP::reorderNodeWithReuses(TreeEntry &TE, ArrayRef<int> Mask) const {
   for (auto *It = TE.ReuseShuffleIndices.begin(),
             *End = TE.ReuseShuffleIndices.end();
        It != End; std::advance(It, Sz))
-    std::iota(It, std::next(It + Sz), 0);
+    std::iota(It, std::next(It, Sz), 0);
 }
 
 void BoUpSLP::reorderTopToBottom() {