[llvm] [Scalar] Use std::none_of (NFC) (PR #143282)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 7 13:00:50 PDT 2025
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/143282
>From a0629037d9cba666970a5f37a1de3d36e1c9bae3 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 7 Jun 2025 09:30:12 -0700
Subject: [PATCH 1/2] [Scalar] Use std::none_of (NFC)
---
llvm/lib/Transforms/Scalar/LICM.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 7965ed76a81b7..d11b4c5ee244a 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -786,8 +786,7 @@ class ControlFlowHoister {
return InitialPreheader;
}
BranchInst *BI = It->first;
- assert(std::find_if(++It, HoistableBranches.end(), HasBBAsSuccessor) ==
- HoistableBranches.end() &&
+ assert(std::none_of(++It, HoistableBranches.end(), HasBBAsSuccessor) &&
"BB is expected to be the target of at most one branch");
LLVMContext &C = BB->getContext();
>From 1796c6abb2eebf1b66e0fe02c68ca2a8ee29ef19 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 7 Jun 2025 12:54:31 -0700
Subject: [PATCH 2/2] Address a comment.
---
llvm/lib/Transforms/Scalar/LICM.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index d11b4c5ee244a..9773ef778b690 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -786,7 +786,8 @@ class ControlFlowHoister {
return InitialPreheader;
}
BranchInst *BI = It->first;
- assert(std::none_of(++It, HoistableBranches.end(), HasBBAsSuccessor) &&
+ assert(std::none_of(std::next(It), HoistableBranches.end(),
+ HasBBAsSuccessor) &&
"BB is expected to be the target of at most one branch");
LLVMContext &C = BB->getContext();
More information about the llvm-commits
mailing list