Skip to content

Commit 9518894

Browse files
author
Leon Clark
committed
Address comments.
1 parent 839f7bd commit 9518894

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3713,23 +3713,19 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
37133713
auto GetIndexRangeInShuffles = [&]() -> std::optional<IndexRange> {
37143714
IndexRange OutputRange = IndexRange(VecTy->getNumElements(), -1);
37153715
for (auto &Use : I.uses()) {
3716-
// All uses must be shufflevector instructions.
3717-
auto *Shuffle = dyn_cast<ShuffleVectorInst>(Use.getUser());
3718-
if (!Shuffle)
3716+
// Ensure all uses match the required pattern.
3717+
User *Shuffle = Use.getUser();
3718+
Value *Op0 = nullptr;
3719+
ArrayRef<int> Mask;
3720+
3721+
if (!match(Shuffle, m_Shuffle(m_Value(Op0), m_Undef(), m_Mask(Mask))))
37193722
return std::nullopt;
37203723

37213724
// Ignore shufflevector instructions that have no uses.
37223725
if (!Shuffle->hasNUsesOrMore(1u))
37233726
continue;
37243727

3725-
// Ensure second operand is a poison value.
3726-
auto *Op0 = Shuffle->getOperand(0);
3727-
auto *Op1 = Shuffle->getOperand(1);
3728-
if (!isa<PoisonValue>(Op1) && !isa<UndefValue>(Op1))
3729-
return std::nullopt;
3730-
37313728
// Find the min and max indices used by the shufflevector instruction.
3732-
ArrayRef<int> Mask = Shuffle->getShuffleMask();
37333729
auto *Op0Ty = cast<FixedVectorType>(Op0->getType());
37343730
auto NumElems = int(Op0Ty->getNumElements());
37353731

0 commit comments

Comments
 (0)