[llvm-branch-commits] [llvm] 70de324 - [IR] Use llvm::is_contained (NFC)
Kazu Hirata via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Dec 8 19:11:50 PST 2020
Author: Kazu Hirata
Date: 2020-12-08T19:06:37-08:00
New Revision: 70de3240466233c640dc74a54068c184ff69b6fc
URL: https://github.com/llvm/llvm-project/commit/70de3240466233c640dc74a54068c184ff69b6fc
DIFF: https://github.com/llvm/llvm-project/commit/70de3240466233c640dc74a54068c184ff69b6fc.diff
LOG: [IR] Use llvm::is_contained (NFC)
Added:
Modified:
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/PrintPasses.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 7ee7140dcd0e..4dd0052c60a2 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -641,10 +641,7 @@ void MDNode::resolveCycles() {
}
static bool hasSelfReference(MDNode *N) {
- for (Metadata *MD : N->operands())
- if (MD == N)
- return true;
- return false;
+ return llvm::is_contained(N->operands(), N);
}
MDNode *MDNode::replaceWithPermanentImpl() {
diff --git a/llvm/lib/IR/PrintPasses.cpp b/llvm/lib/IR/PrintPasses.cpp
index 4cf2a1a7e7cc..83b8c93e766f 100644
--- a/llvm/lib/IR/PrintPasses.cpp
+++ b/llvm/lib/IR/PrintPasses.cpp
@@ -55,11 +55,7 @@ bool llvm::shouldPrintAfterSomePass() {
static bool shouldPrintBeforeOrAfterPass(StringRef PassID,
ArrayRef<std::string> PassesToPrint) {
- for (auto &Pass : PassesToPrint) {
- if (Pass == PassID)
- return true;
- }
- return false;
+ return llvm::is_contained(PassesToPrint, PassID);
}
bool llvm::shouldPrintBeforeAll() { return PrintBeforeAll; }
More information about the llvm-branch-commits
mailing list