[llvm] 2cfb243 - [DAG] Use isAnyConstantBuildVector. NFC

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 06:13:07 PDT 2022


Author: David Green
Date: 2022-05-09T14:13:03+01:00
New Revision: 2cfb243bcd6aeab77dc80455bc8f2061128bd11b

URL: https://github.com/llvm/llvm-project/commit/2cfb243bcd6aeab77dc80455bc8f2061128bd11b
DIFF: https://github.com/llvm/llvm-project/commit/2cfb243bcd6aeab77dc80455bc8f2061128bd11b.diff

LOG: [DAG] Use isAnyConstantBuildVector. NFC

As suggested from 02f8519502447de, this uses the
isAnyConstantBuildVector method in lieu of separate
isBuildVectorOfConstantSDNodes calls. It should
otherwise be an NFC.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index d76e77a7fe13..5102c1b3c37a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -13686,8 +13686,7 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
       if (Op.getOpcode() == ISD::BITCAST &&
           Op.getOperand(0).getValueType() == VT)
         return SDValue(Op.getOperand(0));
-      if (Op.isUndef() || ISD::isBuildVectorOfConstantSDNodes(Op.getNode()) ||
-          ISD::isBuildVectorOfConstantFPSDNodes(Op.getNode()))
+      if (Op.isUndef() || isAnyConstantBuildVector(Op))
         return DAG.getBitcast(VT, Op);
       return SDValue();
     };
@@ -22043,11 +22042,8 @@ static SDValue combineShuffleOfBitcast(ShuffleVectorSDNode *SVN,
       (!Op1.isUndef() && (Op1.getOpcode() != ISD::BITCAST ||
                           Op1.getOperand(0).getValueType() != InVT)))
     return SDValue();
-  if ((ISD::isBuildVectorOfConstantSDNodes(Op0.getOperand(0).getNode()) ||
-       ISD::isBuildVectorOfConstantFPSDNodes(Op0.getOperand(0).getNode())) &&
-      (Op1.isUndef() ||
-       ISD::isBuildVectorOfConstantSDNodes(Op1.getOperand(0).getNode()) ||
-       ISD::isBuildVectorOfConstantFPSDNodes(Op1.getOperand(0).getNode())))
+  if (isAnyConstantBuildVector(Op0.getOperand(0)) &&
+      (Op1.isUndef() || isAnyConstantBuildVector(Op1.getOperand(0))))
     return SDValue();
 
   int VTLanes = VT.getVectorNumElements();


        


More information about the llvm-commits mailing list