[X86] LowerToHorizontalOp - use count_if to count non-UNDEF ops. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 9 Jul 2019 19:19:17 +0000 (19:19 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 9 Jul 2019 19:19:17 +0000 (19:19 +0000)
llvm-svn: 365540

llvm/lib/Target/X86/X86ISelLowering.cpp

index 0e1b54e..370ecef 100644 (file)
@@ -8759,11 +8759,8 @@ static SDValue LowerToHorizontalOp(const BuildVectorSDNode *BV,
                                    const X86Subtarget &Subtarget,
                                    SelectionDAG &DAG) {
   // We need at least 2 non-undef elements to make this worthwhile by default.
-  unsigned NumNonUndefs = 0;
-  for (const SDValue &V : BV->op_values())
-    if (!V.isUndef())
-      ++NumNonUndefs;
-
+  unsigned NumNonUndefs =
+      count_if(BV->op_values(), [](SDValue V) { return !V.isUndef(); });
   if (NumNonUndefs < 2)
     return SDValue();