Skip to content

Commit 35215b6

Browse files
alexey-bataevtru
authored andcommitted
[SLP]Do not to try to revectorize previously vectorized phis in loops
No need to try to revectorize previously vectorized phis in loops, it leads to a compile time blow-up. Fixes #155998 (cherry picked from commit 7730ebc)
1 parent 64dd539 commit 35215b6

File tree

2 files changed

+197
-1
lines changed

2 files changed

+197
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9968,7 +9968,10 @@ BoUpSLP::getScalarsVectorizationLegality(ArrayRef<Value *> VL, unsigned Depth,
99689968
}
99699969
SmallPtrSet<Value *, 8> Values(llvm::from_range, E->Scalars);
99709970
if (all_of(VL, [&](Value *V) {
9971-
return isa<PoisonValue>(V) || Values.contains(V);
9971+
return isa<PoisonValue>(V) || Values.contains(V) ||
9972+
(S.getOpcode() == Instruction::PHI && isa<PHINode>(V) &&
9973+
LI->getLoopFor(S.getMainOp()->getParent()) &&
9974+
isVectorized(V));
99729975
})) {
99739976
LLVM_DEBUG(dbgs() << "SLP: Gathering due to full overlap.\n");
99749977
return ScalarsVectorizationLegality(S, /*IsLegal=*/false);

0 commit comments

Comments
 (0)