Skip to content

Commit 3e16152

Browse files
committed
[SLP] Fix OOB GEP index access for a no-op GEP
Issue is covered by existing test llvm/test/Transforms/SLPVectorizer/RISCV/phi-const.ll See issue #75632 for ideas for how we could catch these more easily in the future.
1 parent 4a72a4e commit 3e16152

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13682,8 +13682,10 @@ void SLPVectorizerPass::collectSeedInstructions(BasicBlock *BB) {
1368213682
// constant index, or a pointer operand that doesn't point to a scalar
1368313683
// type.
1368413684
else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) {
13685+
if (GEP->getNumIndices() != 1)
13686+
continue;
1368513687
Value *Idx = GEP->idx_begin()->get();
13686-
if (GEP->getNumIndices() > 1 || isa<Constant>(Idx))
13688+
if (isa<Constant>(Idx))
1368713689
continue;
1368813690
if (!isValidElementType(Idx->getType()))
1368913691
continue;

0 commit comments

Comments
 (0)