Skip to content

Commit 38cc5bc

Browse files
[llvm] Use DenseMap::contains (NFC)
1 parent a1a63d6 commit 38cc5bc

File tree

5 files changed

+5
-6
lines changed

5 files changed

+5
-6
lines changed

llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ void BlockFrequencyInfoImpl<BT>::initTransitionProbabilities(
15801580
SmallPtrSet<const BlockT *, 2> UniqueSuccs;
15811581
for (const auto SI : children<const BlockT *>(BB)) {
15821582
// Ignore cold blocks
1583-
if (BlockIndex.find(SI) == BlockIndex.end())
1583+
if (!BlockIndex.contains(SI))
15841584
continue;
15851585
// Ignore parallel edges between BB and SI blocks
15861586
if (!UniqueSuccs.insert(SI).second)

llvm/include/llvm/Analysis/DependenceGraphBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ template <class GraphType> class AbstractDependenceGraphBuilder {
163163

164164
/// Given a node \p N return its associated ordinal number.
165165
size_t getOrdinal(NodeType &N) {
166-
assert(NodeOrdinalMap.find(&N) != NodeOrdinalMap.end() &&
167-
"No ordinal computed for this node.");
166+
assert(NodeOrdinalMap.contains(&N) && "No ordinal computed for this node.");
168167
return NodeOrdinalMap[&N];
169168
}
170169

llvm/include/llvm/Analysis/EHUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void computeEHOnlyBlocks(FunctionT &F, DenseSet<BlockT *> &EHBlocks) {
2424
DenseMap<BlockT *, Status> Statuses;
2525

2626
auto GetStatus = [&](BlockT *BB) {
27-
if (Statuses.find(BB) != Statuses.end())
27+
if (Statuses.contains(BB))
2828
return Statuses[BB];
2929
else
3030
return Unknown;

llvm/include/llvm/Analysis/VectorUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ template <typename InstTy> class InterleaveGroup {
670670
return false;
671671

672672
// Skip if there is already a member with the same index.
673-
if (Members.find(Key) != Members.end())
673+
if (Members.contains(Key))
674674
return false;
675675

676676
if (Key > LargestKey) {

llvm/include/llvm/Transforms/Utils/SampleProfileInference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ FlowFunction SampleProfileInference<BT>::createFlowFunction(
247247
// Create FlowBlocks
248248
for (const auto *BB : BasicBlocks) {
249249
FlowBlock Block;
250-
if (SampleBlockWeights.find(BB) != SampleBlockWeights.end()) {
250+
if (SampleBlockWeights.contains(BB)) {
251251
Block.HasUnknownWeight = false;
252252
Block.Weight = SampleBlockWeights[BB];
253253
} else {

0 commit comments

Comments
 (0)