[llvm] r359974 - [SelectionDAG] Use any_of/all_of where possible. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 03:30:04 PDT 2019
Author: rksimon
Date: Sun May 5 03:30:04 2019
New Revision: 359974
URL: http://llvm.org/viewvc/llvm-project?rev=359974&view=rev
Log:
[SelectionDAG] Use any_of/all_of where possible. NFCI.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=359974&r1=359973&r2=359974&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun May 5 03:30:04 2019
@@ -262,12 +262,7 @@ bool ISD::allOperandsUndef(const SDNode
// is probably the desired behavior.
if (N->getNumOperands() == 0)
return false;
-
- for (const SDValue &Op : N->op_values())
- if (!Op.isUndef())
- return false;
-
- return true;
+ return all_of(N->op_values(), [](SDValue Op) { return Op.isUndef(); });
}
bool ISD::matchUnaryPredicate(SDValue Op,
@@ -8761,17 +8756,12 @@ bool SDNode::areOnlyUsersOf(ArrayRef<con
/// isOperand - Return true if this node is an operand of N.
bool SDValue::isOperandOf(const SDNode *N) const {
- for (const SDValue &Op : N->op_values())
- if (*this == Op)
- return true;
- return false;
+ return any_of(N->op_values(), [this](SDValue Op) { return *this == Op; });
}
bool SDNode::isOperandOf(const SDNode *N) const {
- for (const SDValue &Op : N->op_values())
- if (this == Op.getNode())
- return true;
- return false;
+ return any_of(N->op_values(),
+ [this](SDValue Op) { return this == Op.getNode(); });
}
/// reachesChainWithoutSideEffects - Return true if this operand (which must
More information about the llvm-commits
mailing list