[llvm] r367181 - [DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 12:42:58 PDT 2019


Author: rksimon
Date: Sat Jul 27 12:42:58 2019
New Revision: 367181

URL: http://llvm.org/viewvc/llvm-project?rev=367181&view=rev
Log:
[DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI.

If the subvector binop is illegal then early-out and avoid the subvector searches.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=367181&r1=367180&r2=367181&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Jul 27 12:42:58 2019
@@ -18023,13 +18023,16 @@ static SDValue narrowInsertExtractVector
   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




More information about the llvm-commits mailing list