[llvm] 2ab6d1e - [SLP][NFC]Move some check to the outer if to simplify inner checks.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 11:01:39 PST 2024
Author: Alexey Bataev
Date: 2024-03-01T10:58:41-08:00
New Revision: 2ab6d1e18e120430fbf454a074c52fa054e08537
URL: https://github.com/llvm/llvm-project/commit/2ab6d1e18e120430fbf454a074c52fa054e08537
DIFF: https://github.com/llvm/llvm-project/commit/2ab6d1e18e120430fbf454a074c52fa054e08537.diff
LOG: [SLP][NFC]Move some check to the outer if to simplify inner checks.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 629d0a0e3a282b..47681342239e1d 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4510,23 +4510,21 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom) {
return std::nullopt; // No need to reorder.
return std::move(ResOrder);
}
- if (TE.State == TreeEntry::NeedToGather) {
+ if (TE.State == TreeEntry::NeedToGather && !TE.isAltShuffle() &&
+ allSameType(TE.Scalars)) {
// TODO: add analysis of other gather nodes with extractelement
// instructions and other values/instructions, not only undefs.
- if (((TE.getOpcode() == Instruction::ExtractElement &&
- !TE.isAltShuffle()) ||
+ if ((TE.getOpcode() == Instruction::ExtractElement ||
(all_of(TE.Scalars,
[](Value *V) {
return isa<UndefValue, ExtractElementInst>(V);
}) &&
any_of(TE.Scalars,
[](Value *V) { return isa<ExtractElementInst>(V); }))) &&
- all_of(TE.Scalars,
- [](Value *V) {
- auto *EE = dyn_cast<ExtractElementInst>(V);
- return !EE || isa<FixedVectorType>(EE->getVectorOperandType());
- }) &&
- allSameType(TE.Scalars)) {
+ all_of(TE.Scalars, [](Value *V) {
+ auto *EE = dyn_cast<ExtractElementInst>(V);
+ return !EE || isa<FixedVectorType>(EE->getVectorOperandType());
+ })) {
// Check that gather of extractelements can be represented as
// just a shuffle of a single vector.
OrdersType CurrentOrder;
More information about the llvm-commits
mailing list