Skip to content

Commit 265f960

Browse files
author
Leon Clark
committed
Address comments.
1 parent 1092f5b commit 265f960

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
@@ -3505,23 +3505,19 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
35053505
auto GetIndexRangeInShuffles = [&]() -> std::optional<IndexRange> {
35063506
IndexRange OutputRange = IndexRange(VecTy->getNumElements(), -1);
35073507
for (auto &Use : I.uses()) {
3508-
// All uses must be shufflevector instructions.
3509-
auto *Shuffle = dyn_cast<ShuffleVectorInst>(Use.getUser());
3510-
if (!Shuffle)
3508+
// Ensure all uses match the required pattern.
3509+
User *Shuffle = Use.getUser();
3510+
Value *Op0 = nullptr;
3511+
ArrayRef<int> Mask;
3512+
3513+
if (!match(Shuffle, m_Shuffle(m_Value(Op0), m_Undef(), m_Mask(Mask))))
35113514
return std::nullopt;
35123515

35133516
// Ignore shufflevector instructions that have no uses.
35143517
if (!Shuffle->hasNUsesOrMore(1u))
35153518
continue;
35163519

3517-
// Ensure second operand is a poison value.
3518-
auto *Op0 = Shuffle->getOperand(0);
3519-
auto *Op1 = Shuffle->getOperand(1);
3520-
if (!isa<PoisonValue>(Op1) && !isa<UndefValue>(Op1))
3521-
return std::nullopt;
3522-
35233520
// Find the min and max indices used by the shufflevector instruction.
3524-
ArrayRef<int> Mask = Shuffle->getShuffleMask();
35253521
auto *Op0Ty = cast<FixedVectorType>(Op0->getType());
35263522
auto NumElems = int(Op0Ty->getNumElements());
35273523

0 commit comments

Comments
 (0)