[llvm] a55b35d - [X86] combineVectorInsert - pull out Vec/Scl/Idx operands. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 11 06:04:59 PST 2023
Author: Simon Pilgrim
Date: 2023-02-11T14:02:00Z
New Revision: a55b35dbee6dc1391f357cb10794b104c853253d
URL: https://github.com/llvm/llvm-project/commit/a55b35dbee6dc1391f357cb10794b104c853253d
DIFF: https://github.com/llvm/llvm-project/commit/a55b35dbee6dc1391f357cb10794b104c853253d.diff
LOG: [X86] combineVectorInsert - pull out Vec/Scl/Idx operands. NFC.
These will be reused in a future patch
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 e7e4e91bced0..80b2da686232 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -48530,10 +48530,13 @@ static SDValue combineVectorInsert(SDNode *N, SelectionDAG &DAG,
Opcode == ISD::INSERT_VECTOR_ELT) &&
"Unexpected vector insertion");
+ SDValue Vec = N->getOperand(0);
+ SDValue Scl = N->getOperand(1);
+ SDValue Idx = N->getOperand(2);
+
// Fold insert_vector_elt(undef, elt, 0) --> scalar_to_vector(elt).
- if (Opcode == ISD::INSERT_VECTOR_ELT && N->getOperand(0).isUndef() &&
- isNullConstant(N->getOperand(2)))
- return DAG.getNode(ISD::SCALAR_TO_VECTOR, SDLoc(N), VT, N->getOperand(1));
+ if (Opcode == ISD::INSERT_VECTOR_ELT && Vec.isUndef() && isNullConstant(Idx))
+ return DAG.getNode(ISD::SCALAR_TO_VECTOR, SDLoc(N), VT, Scl);
if (Opcode == X86ISD::PINSRB || Opcode == X86ISD::PINSRW) {
unsigned NumBitsPerElt = VT.getScalarSizeInBits();
More information about the llvm-commits
mailing list