[llvm] 41455dd - [X86] Remove isTargetShuffleSplat and just use SelectionDAG::isSplatValue
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 19 03:28:50 PDT 2022
Author: Simon Pilgrim
Date: 2022-06-19T11:22:57+01:00
New Revision: 41455dd1dcbbdf2f5fb34cc1f248bfd8d947dc52
URL: https://github.com/llvm/llvm-project/commit/41455dd1dcbbdf2f5fb34cc1f248bfd8d947dc52
DIFF: https://github.com/llvm/llvm-project/commit/41455dd1dcbbdf2f5fb34cc1f248bfd8d947dc52.diff
LOG: [X86] Remove isTargetShuffleSplat and just use SelectionDAG::isSplatValue
shuffle(splat(x)) -> splat(x), it doesn't have to be a target specific broadcast
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1b4c9e173468..56e40806c4ac 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -5239,13 +5239,6 @@ static bool isTargetShuffleVariableMask(unsigned Opcode) {
}
}
-static bool isTargetShuffleSplat(SDValue Op) {
- unsigned Opcode = Op.getOpcode();
- if (Opcode == ISD::EXTRACT_SUBVECTOR)
- return isTargetShuffleSplat(Op.getOperand(0));
- return Opcode == X86ISD::VBROADCAST || Opcode == X86ISD::VBROADCAST_LOAD;
-}
-
SDValue X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) const {
MachineFunction &MF = DAG.getMachineFunction();
const X86RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
@@ -37637,12 +37630,13 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
}
}
- // If we are shuffling a broadcast (and not introducing zeros) then
- // we can just use the broadcast directly. This works for smaller broadcast
- // elements as well as they already repeat across each mask element
- if (UnaryShuffle && isTargetShuffleSplat(V1) && !isAnyZero(BaseMask) &&
+ // If we are shuffling a splat (and not introducing zeros) then we can just
+ // use it directly. This works for smaller elements as well as they already
+ // repeat across each mask element.
+ if (UnaryShuffle && !isAnyZero(BaseMask) &&
+ V1.getValueSizeInBits() >= RootSizeInBits &&
(BaseMaskEltSizeInBits % V1.getScalarValueSizeInBits()) == 0 &&
- V1.getValueSizeInBits() >= RootSizeInBits) {
+ DAG.isSplatValue(V1, /*AllowUndefs*/ false)) {
return CanonicalizeShuffleInput(RootVT, V1);
}
@@ -41216,10 +41210,10 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
}
}
- // For broadcasts, unless we *only* demand the 0'th element,
+ // For splats, unless we *only* demand the 0'th element,
// stop attempts at simplification here, we aren't going to improve things,
// this is better than any potential shuffle.
- if (isTargetShuffleSplat(Op) && !DemandedElts.isOne())
+ if (!DemandedElts.isOne() && TLO.DAG.isSplatValue(Op, /*AllowUndefs*/false))
return false;
// Get target/faux shuffle mask.
More information about the llvm-commits
mailing list