[llvm] [SLP] Fix crash on extractelement with out-of-bounds index.....Fixes … (PR #176918)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 20 09:46:39 PST 2026


================
@@ -7990,7 +7999,17 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom,
         if (Idx == PoisonMaskElem)
           continue;
         Value *V = TE.Scalars[ReorderMask[Idx]];
+        // UPDATION: to go with the new implementation of getExtractIndex()
+        if (isa<PoisonValue>(V))
+        {
+          continue; // safeguard to not cast them to instruction
+        }
+
         std::optional<unsigned> EI = getExtractIndex(cast<Instruction>(V));
+        if (!EI)
+        {
+          continue; // checking to the optional has value or not
+        }
----------------
alexey-bataev wrote:

Same, doubt we need this check

https://github.com/llvm/llvm-project/pull/176918


More information about the llvm-commits mailing list