From 70682ef44f9f3ae65b1cd92a2e3356768510f05d Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 11 Feb 2022 16:39:56 +0000 Subject: [PATCH] [X86] combineToExtendBoolVectorInReg - use explicit arguments. NFC. Replace the *_EXTEND node with the raw operands, this will make it easier to use combineToExtendBoolVectorInReg for any boolvec extension combine. Cleanup prep for Issue #53760 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 77c2e7d169907f..8758e143c100ca 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -50437,11 +50437,9 @@ static SDValue combineToExtendCMOV(SDNode *Extend, SelectionDAG &DAG) { // Convert (vXiY *ext(vXi1 bitcast(iX))) to extend_in_reg(broadcast(iX)). // This is more or less the reverse of combineBitcastvxi1. -static SDValue -combineToExtendBoolVectorInReg(SDNode *N, SelectionDAG &DAG, - TargetLowering::DAGCombinerInfo &DCI, - const X86Subtarget &Subtarget) { - unsigned Opcode = N->getOpcode(); +static SDValue combineToExtendBoolVectorInReg( + unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N0, SelectionDAG &DAG, + TargetLowering::DAGCombinerInfo &DCI, const X86Subtarget &Subtarget) { if (Opcode != ISD::SIGN_EXTEND && Opcode != ISD::ZERO_EXTEND && Opcode != ISD::ANY_EXTEND) return SDValue(); @@ -50450,8 +50448,6 @@ combineToExtendBoolVectorInReg(SDNode *N, SelectionDAG &DAG, if (!Subtarget.hasSSE2() || Subtarget.hasAVX512()) return SDValue(); - SDValue N0 = N->getOperand(0); - EVT VT = N->getValueType(0); EVT SVT = VT.getScalarType(); EVT InSVT = N0.getValueType().getScalarType(); unsigned EltSizeInBits = SVT.getSizeInBits(); @@ -50466,13 +50462,12 @@ combineToExtendBoolVectorInReg(SDNode *N, SelectionDAG &DAG, return SDValue(); SDValue N00 = N0.getOperand(0); - EVT SclVT = N0.getOperand(0).getValueType(); + EVT SclVT = N00.getValueType(); if (!SclVT.isScalarInteger()) return SDValue(); - SDLoc DL(N); SDValue Vec; - SmallVector ShuffleMask; + SmallVector ShuffleMask; unsigned NumElts = VT.getVectorNumElements(); assert(NumElts == SclVT.getSizeInBits() && "Unexpected bool vector size"); @@ -50618,7 +50613,8 @@ static SDValue combineSext(SDNode *N, SelectionDAG &DAG, if (SDValue V = combineExtSetcc(N, DAG, Subtarget)) return V; - if (SDValue V = combineToExtendBoolVectorInReg(N, DAG, DCI, Subtarget)) + if (SDValue V = combineToExtendBoolVectorInReg(N->getOpcode(), DL, VT, N0, + DAG, DCI, Subtarget)) return V; if (VT.isVector()) { @@ -50772,7 +50768,8 @@ static SDValue combineZext(SDNode *N, SelectionDAG &DAG, if (SDValue V = combineExtSetcc(N, DAG, Subtarget)) return V; - if (SDValue V = combineToExtendBoolVectorInReg(N, DAG, DCI, Subtarget)) + if (SDValue V = combineToExtendBoolVectorInReg(N->getOpcode(), dl, VT, N0, + DAG, DCI, Subtarget)) return V; if (VT.isVector())