summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-01-13 19:14:41 -0800
committerKazu Hirata <kazu@google.com>2021-01-13 19:14:41 -0800
commit5c1c39e8d808d7d08a2c3c5ed192d543a55f685c (patch)
tree53e591a488e498de8bbe9f4514460a51fbf2022a
parent56d1ffb927d03958a7a31442596df749264a7792 (diff)
downloadllvm-5c1c39e8d808d7d08a2c3c5ed192d543a55f685c.tar.gz
[llvm] Use *Set::contains (NFC)
-rw-r--r--llvm/include/llvm/ADT/DepthFirstIterator.h2
-rw-r--r--llvm/include/llvm/Analysis/DivergenceAnalysis.h2
-rw-r--r--llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h2
-rw-r--r--llvm/lib/Analysis/IRSimilarityIdentifier.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp2
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.h10
-rw-r--r--llvm/lib/Transforms/IPO/IROutliner.cpp9
7 files changed, 14 insertions, 15 deletions
diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h
index 11967f5eefcc..5bfea28332b2 100644
--- a/llvm/include/llvm/ADT/DepthFirstIterator.h
+++ b/llvm/include/llvm/ADT/DepthFirstIterator.h
@@ -198,7 +198,7 @@ public:
// nodes that a depth first iteration did not find: ie unreachable nodes.
//
bool nodeVisited(NodeRef Node) const {
- return this->Visited.count(Node) != 0;
+ return this->Visited.contains(Node);
}
/// getPathLength - Return the length of the path from the entry node to the
diff --git a/llvm/include/llvm/Analysis/DivergenceAnalysis.h b/llvm/include/llvm/Analysis/DivergenceAnalysis.h
index 8a32bfbcc758..2e4ae65d0981 100644
--- a/llvm/include/llvm/Analysis/DivergenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DivergenceAnalysis.h
@@ -118,7 +118,7 @@ private:
///
/// (see markBlockJoinDivergent).
bool isJoinDivergent(const BasicBlock &Block) const {
- return DivergentJoinBlocks.find(&Block) != DivergentJoinBlocks.end();
+ return DivergentJoinBlocks.contains(&Block);
}
private:
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index 7e5a723991d4..2f80b4373b46 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -339,7 +339,7 @@ public:
/// Returns true if vector representation of the instruction \p I
/// requires mask.
- bool isMaskRequired(const Instruction *I) { return (MaskedOp.count(I) != 0); }
+ bool isMaskRequired(const Instruction *I) { return MaskedOp.contains(I); }
unsigned getNumStores() const { return LAI->getNumStores(); }
unsigned getNumLoads() const { return LAI->getNumLoads(); }
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index 60b4f427e189..d8403abc3027 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -402,7 +402,7 @@ static bool checkNumberingAndReplaceCommutative(
DenseSet<unsigned> NewSet;
for (unsigned &Curr : ValueMappingIt->second)
// If we can find the value in the mapping, we add it to the new set.
- if (TargetValueNumbers.find(Curr) != TargetValueNumbers.end())
+ if (TargetValueNumbers.contains(Curr))
NewSet.insert(Curr);
// If we could not find a Value, return 0.
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 7e4ee3beeeed..24bc7fe7e0ad 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1928,7 +1928,7 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) {
auto AddToWorklist = [&](unsigned CurIdx, SDNode *Op, unsigned OpNumber) {
// If this is an Op, we can remove the op from the list. Remark any
// search associated with it as from the current OpNumber.
- if (SeenOps.count(Op) != 0) {
+ if (SeenOps.contains(Op)) {
Changed = true;
DidPruneOps = true;
unsigned OrigOpNumber = 0;
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
index 83b64b5171c0..52e7eda90310 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.h
@@ -102,22 +102,22 @@ class MCJIT : public ExecutionEngine {
}
bool hasModuleBeenAddedButNotLoaded(Module *M) {
- return AddedModules.count(M) != 0;
+ return AddedModules.contains(M);
}
bool hasModuleBeenLoaded(Module *M) {
// If the module is in either the "loaded" or "finalized" sections it
// has been loaded.
- return (LoadedModules.count(M) != 0 ) || (FinalizedModules.count(M) != 0);
+ return LoadedModules.contains(M) || FinalizedModules.contains(M);
}
bool hasModuleBeenFinalized(Module *M) {
- return FinalizedModules.count(M) != 0;
+ return FinalizedModules.contains(M);
}
bool ownsModule(Module* M) {
- return (AddedModules.count(M) != 0) || (LoadedModules.count(M) != 0) ||
- (FinalizedModules.count(M) != 0);
+ return AddedModules.contains(M) || LoadedModules.contains(M) ||
+ FinalizedModules.contains(M);
}
void markModuleAsLoaded(Module *M) {
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index f6fdd69d71c3..da9ac99ff802 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -304,7 +304,7 @@ collectRegionsConstants(OutlinableRegion &Region,
unsigned GVN = GVNOpt.getValue();
// Check if this global value has been found to not be the same already.
- if (NotSame.find(GVN) != NotSame.end()) {
+ if (NotSame.contains(GVN)) {
if (isa<Constant>(V))
ConstantsTheSame = false;
continue;
@@ -421,8 +421,7 @@ static void findConstants(IRSimilarityCandidate &C, DenseSet<unsigned> &NotSame,
// global value numbering.
unsigned GVN = C.getGVN(V).getValue();
if (isa<Constant>(V))
- if (NotSame.find(GVN) != NotSame.end() &&
- Seen.find(GVN) == Seen.end()) {
+ if (NotSame.contains(GVN) && !Seen.contains(GVN)) {
Inputs.push_back(GVN);
Seen.insert(GVN);
}
@@ -673,7 +672,7 @@ findExtractedOutputToOverallOutputMapping(OutlinableRegion &Region,
if (Group.ArgumentTypes[Jdx] != PointerType::getUnqual(Output->getType()))
continue;
- if (AggArgsUsed.find(Jdx) != AggArgsUsed.end())
+ if (AggArgsUsed.contains(Jdx))
continue;
TypeFound = true;
@@ -925,7 +924,7 @@ collectRelevantInstructions(Function &F,
std::vector<Instruction *> RelevantInstructions;
for (BasicBlock &BB : F) {
- if (ExcludeBlocks.find(&BB) != ExcludeBlocks.end())
+ if (ExcludeBlocks.contains(&BB))
continue;
for (Instruction &Inst : BB) {