Skip to content

Commit

Permalink
[SLP][NFC]Use GatheredScalars vector instead of the original E->Scala…
Browse files Browse the repository at this point in the history
…rs, NFC

GateredScalars is a full copy of the E->Scalars in this places and can
be safely used for now. Unifies the code across the function.
  • Loading branch information
alexey-bataev committed Aug 14, 2024
1 parent 4c2f90f commit 20b2c9f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13096,12 +13096,12 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
Res = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
} else {
// Gather all constants.
SmallVector<int> Mask(E->Scalars.size(), PoisonMaskElem);
for (auto [I, V] : enumerate(E->Scalars)) {
SmallVector<int> Mask(GatheredScalars.size(), PoisonMaskElem);
for (auto [I, V] : enumerate(GatheredScalars)) {
if (!isa<PoisonValue>(V))
Mask[I] = I;
}
Value *BV = ShuffleBuilder.gather(E->Scalars);
Value *BV = ShuffleBuilder.gather(GatheredScalars);
ShuffleBuilder.add(BV, Mask);
Res = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
}
Expand Down

0 comments on commit 20b2c9f

Please sign in to comment.