[llvm-branch-commits] [llvm] 805d595 - [Analysis, CodeGen, IR] Use contains (NFC)
Kazu Hirata via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Dec 18 19:13:45 PST 2020
Author: Kazu Hirata
Date: 2020-12-18T19:08:17-08:00
New Revision: 805d59593f50a5c5050c0fc5cb9fbe02cd751511
URL: https://github.com/llvm/llvm-project/commit/805d59593f50a5c5050c0fc5cb9fbe02cd751511
DIFF: https://github.com/llvm/llvm-project/commit/805d59593f50a5c5050c0fc5cb9fbe02cd751511.diff
LOG: [Analysis, CodeGen, IR] Use contains (NFC)
Added:
Modified:
llvm/lib/Analysis/BranchProbabilityInfo.cpp
llvm/lib/Analysis/DivergenceAnalysis.cpp
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/IR/ModuleSummaryIndex.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index ac5dbe1ce6e9..d4cb46c82e3a 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -795,8 +795,7 @@ bool BranchProbabilityInfo::calcLoopBranchHeuristics(const BasicBlock *BB,
for (const_succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) {
LoopBlock SuccLB(*I, LI, *SccI.get());
LoopEdge Edge(LB, SuccLB);
- bool IsUnlikelyEdge =
- LB.getLoop() && (UnlikelyBlocks.find(*I) != UnlikelyBlocks.end());
+ bool IsUnlikelyEdge = LB.getLoop() && UnlikelyBlocks.contains(*I);
if (IsUnlikelyEdge)
UnlikelyEdges.push_back(I.getSuccessorIndex());
diff --git a/llvm/lib/Analysis/DivergenceAnalysis.cpp b/llvm/lib/Analysis/DivergenceAnalysis.cpp
index c10971dab95c..7bd25de43ffb 100644
--- a/llvm/lib/Analysis/DivergenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DivergenceAnalysis.cpp
@@ -118,7 +118,7 @@ bool DivergenceAnalysis::isTemporalDivergent(const BasicBlock &ObservingBlock,
for (const auto *Loop = LI.getLoopFor(Inst->getParent());
Loop != RegionLoop && !Loop->contains(&ObservingBlock);
Loop = Loop->getParentLoop()) {
- if (DivergentLoops.find(Loop) != DivergentLoops.end())
+ if (DivergentLoops.contains(Loop))
return true;
}
@@ -332,11 +332,11 @@ void DivergenceAnalysis::compute() {
}
bool DivergenceAnalysis::isAlwaysUniform(const Value &V) const {
- return UniformOverrides.find(&V) != UniformOverrides.end();
+ return UniformOverrides.contains(&V);
}
bool DivergenceAnalysis::isDivergent(const Value &V) const {
- return DivergentValues.find(&V) != DivergentValues.end();
+ return DivergentValues.contains(&V);
}
bool DivergenceAnalysis::isDivergentUse(const Use &U) const {
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index dc8385ff87e6..41e234651349 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -286,14 +286,14 @@ bool checkNumberingAndReplace(
// instruction.
DenseSet<unsigned> &TargetSet = Val->second;
- if (TargetSet.size() > 1 && TargetSet.find(TargetArgVal) != TargetSet.end()) {
+ if (TargetSet.size() > 1 && TargetSet.contains(TargetArgVal)) {
TargetSet.clear();
TargetSet.insert(TargetArgVal);
return true;
}
// Return true if we can find the value in the set.
- return TargetSet.find(TargetArgVal) != TargetSet.end();
+ return TargetSet.contains(TargetArgVal);
}
bool IRSimilarityCandidate::compareOperandMapping(OperandMapping A,
@@ -375,14 +375,12 @@ bool IRSimilarityCandidate::compareStructure(const IRSimilarityCandidate &A,
// Ensure that the mappings for the instructions exists.
std::tie(ValueMappingIt, WasInserted) = ValueNumberMappingA.insert(
std::make_pair(InstValA, DenseSet<unsigned>({InstValB})));
- if (!WasInserted && ValueMappingIt->second.find(InstValB) ==
- ValueMappingIt->second.end())
+ if (!WasInserted && !ValueMappingIt->second.contains(InstValB))
return false;
std::tie(ValueMappingIt, WasInserted) = ValueNumberMappingB.insert(
std::make_pair(InstValB, DenseSet<unsigned>({InstValA})));
- if (!WasInserted && ValueMappingIt->second.find(InstValA) ==
- ValueMappingIt->second.end())
+ if (!WasInserted && !ValueMappingIt->second.contains(InstValA))
return false;
// TODO: Handle commutative instructions by mapping one operand to many
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index e7256a98eb87..04ead18cc3de 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2679,7 +2679,7 @@ std::tuple<bool, bool> InstrRefBasedLDV::vlocJoin(
for (auto p : BlockOrders) {
// If the predecessor isn't in scope / to be explored, we'll never be
// able to join any locations.
- if (BlocksToExplore.find(p) == BlocksToExplore.end()) {
+ if (!BlocksToExplore.contains(p)) {
Bail = true;
break;
}
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 5346323ceabb..5d21ca759f35 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -179,7 +179,7 @@ propagateAttributesToRefs(GlobalValueSummary *S,
if (!VI.getAccessSpecifier()) {
if (!MarkedNonReadWriteOnly.insert(VI).second)
continue;
- } else if (MarkedNonReadWriteOnly.find(VI) != MarkedNonReadWriteOnly.end())
+ } else if (MarkedNonReadWriteOnly.contains(VI))
continue;
for (auto &Ref : VI.getSummaryList())
// If references to alias is not read/writeonly then aliasee
More information about the llvm-branch-commits
mailing list