[llvm] 572dfef - [SelectionDAG] Use llvm::any_of to simplify a loop. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 19:11:26 PDT 2022


Author: Craig Topper
Date: 2022-05-04T19:09:06-07:00
New Revision: 572dfef1dbfd59b0a6ecbeffd2bcbe039e11c097

URL: https://github.com/llvm/llvm-project/commit/572dfef1dbfd59b0a6ecbeffd2bcbe039e11c097
DIFF: https://github.com/llvm/llvm-project/commit/572dfef1dbfd59b0a6ecbeffd2bcbe039e11c097.diff

LOG: [SelectionDAG] Use llvm::any_of to simplify a loop. NFC

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 2b65242235460..a4f20c86e1ec0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -3444,12 +3444,10 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
       // such nodes must have a chain, it suffices to check ChainNodesMatched.
       // We need to perform this check before potentially modifying one of the
       // nodes via MorphNode.
-      bool MayRaiseFPException = false;
-      for (auto *N : ChainNodesMatched)
-        if (mayRaiseFPException(N) && !N->getFlags().hasNoFPExcept()) {
-          MayRaiseFPException = true;
-          break;
-        }
+      bool MayRaiseFPException =
+          llvm::any_of(ChainNodesMatched, [this](SDNode *N) {
+            return mayRaiseFPException(N) && !N->getFlags().hasNoFPExcept();
+          });
 
       // Create the node.
       MachineSDNode *Res = nullptr;


        


More information about the llvm-commits mailing list