Skip to content

Commit 2ab6d1e

Browse files
committed
[SLP][NFC]Move some check to the outer if to simplify inner checks.
1 parent 137ed17 commit 2ab6d1e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4510,23 +4510,21 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom) {
45104510
return std::nullopt; // No need to reorder.
45114511
return std::move(ResOrder);
45124512
}
4513-
if (TE.State == TreeEntry::NeedToGather) {
4513+
if (TE.State == TreeEntry::NeedToGather && !TE.isAltShuffle() &&
4514+
allSameType(TE.Scalars)) {
45144515
// TODO: add analysis of other gather nodes with extractelement
45154516
// instructions and other values/instructions, not only undefs.
4516-
if (((TE.getOpcode() == Instruction::ExtractElement &&
4517-
!TE.isAltShuffle()) ||
4517+
if ((TE.getOpcode() == Instruction::ExtractElement ||
45184518
(all_of(TE.Scalars,
45194519
[](Value *V) {
45204520
return isa<UndefValue, ExtractElementInst>(V);
45214521
}) &&
45224522
any_of(TE.Scalars,
45234523
[](Value *V) { return isa<ExtractElementInst>(V); }))) &&
4524-
all_of(TE.Scalars,
4525-
[](Value *V) {
4526-
auto *EE = dyn_cast<ExtractElementInst>(V);
4527-
return !EE || isa<FixedVectorType>(EE->getVectorOperandType());
4528-
}) &&
4529-
allSameType(TE.Scalars)) {
4524+
all_of(TE.Scalars, [](Value *V) {
4525+
auto *EE = dyn_cast<ExtractElementInst>(V);
4526+
return !EE || isa<FixedVectorType>(EE->getVectorOperandType());
4527+
})) {
45304528
// Check that gather of extractelements can be represented as
45314529
// just a shuffle of a single vector.
45324530
OrdersType CurrentOrder;

0 commit comments

Comments
 (0)