From: Simon Pilgrim Date: Sat, 27 Jul 2019 19:42:58 +0000 (+0000) Subject: [DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c64f519ea0da2c3bf49a4e421c25a82b66230a17;p=llvm [DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI. If the subvector binop is illegal then early-out and avoid the subvector searches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367181 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2201fc24483..4b3db73875b 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18023,13 +18023,16 @@ static SDValue narrowInsertExtractVectorBinOp(SDNode *Extract, SDValue Bop0 = BinOp.getOperand(0), Bop1 = BinOp.getOperand(1); SDValue Index = Extract->getOperand(1); EVT SubVT = Extract->getValueType(0); + if (!TLI.isOperationLegalOrCustom(BinOpcode, SubVT)) + return SDValue(); + SDValue Sub0 = getSubVectorSrc(Bop0, Index, SubVT); SDValue Sub1 = getSubVectorSrc(Bop1, Index, SubVT); // TODO: We could handle the case where only 1 operand is being inserted by // creating an extract of the other operand, but that requires checking // number of uses and/or costs. - if (!Sub0 || !Sub1 || !TLI.isOperationLegalOrCustom(BinOpcode, SubVT)) + if (!Sub0 || !Sub1) return SDValue(); // We are inserting both operands of the wide binop only to extract back