[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:21:13 PST 2026
================
@@ -15042,7 +15042,14 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
}
if (DemandedElts.isZero())
DemandedElts = APInt::getZero(getNumElements(SrcVecTy));
- DemandedElts.setBit(*getExtractIndex(I));
+ unsigned ExtIdx = *getExtractIndex(I);
+ //Out-of-bounds extractelement produces poison.So it do no corresponds to a concrete vector lane,
+ // so instead of treating it as an invalid pattern we can avoid marking any demanded element
+ if (ExtIdx < DemandedElts.getBitWidth())
+ {
+ DemandedElts.setBit(ExtIdx);
+ }
+ // DemandedElts.setBit(*getExtractIndex(I));
----------------
alexey-bataev wrote:
I don't see the changes in getExtractIndex
https://github.com/llvm/llvm-project/pull/176918
More information about the llvm-commits
mailing list