Skip to content

Commit 03dc806

Browse files
[Transforms] Use {DenseMap,SmallPtrSet}::contains (NFC)
1 parent 4532617 commit 03dc806

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ struct AllSwitchPaths {
521521

522522
const BasicBlock *PrevBB = Path.back();
523523
for (const BasicBlock *BB : Path) {
524-
if (StateDef.count(BB) != 0) {
524+
if (StateDef.contains(BB)) {
525525
const PHINode *Phi = dyn_cast<PHINode>(StateDef[BB]);
526526
assert(Phi && "Expected a state-defining instr to be a phi node.");
527527

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
592592

593593
/// Returns true if a value number exists for the specified value.
594594
bool GVNPass::ValueTable::exists(Value *V) const {
595-
return valueNumbering.count(V) != 0;
595+
return valueNumbering.contains(V);
596596
}
597597

598598
/// lookup_or_add - Returns the value number for the specified value, assigning

llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ static void relocationViaAlloca(
20572057
for (const auto &Info : Records)
20582058
for (auto RematerializedValuePair : Info.RematerializedValues) {
20592059
Value *OriginalValue = RematerializedValuePair.second;
2060-
if (AllocaMap.count(OriginalValue) != 0)
2060+
if (AllocaMap.contains(OriginalValue))
20612061
continue;
20622062

20632063
emitAllocaFor(OriginalValue);

llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
6464
// sure that the return is covered. Otherwise, we can check whether there
6565
// is a way to reach the RI from the start of the lifetime without passing
6666
// through an end.
67-
if (EndBlocks.count(RI->getParent()) > 0 ||
67+
if (EndBlocks.contains(RI->getParent()) ||
6868
!isPotentiallyReachable(Start, RI, &EndBlocks, &DT, &LI)) {
6969
++NumCoveredExits;
7070
}

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6443,7 +6443,7 @@ bool BoUpSLP::areAllUsersVectorized(
64436443
Instruction *I, const SmallDenseSet<Value *> *VectorizedVals) const {
64446444
return (I->hasOneUse() && (!VectorizedVals || VectorizedVals->contains(I))) ||
64456445
all_of(I->users(), [this](User *U) {
6446-
return ScalarToTreeEntry.count(U) > 0 ||
6446+
return ScalarToTreeEntry.contains(U) ||
64476447
isVectorLikeInstWithConstOps(U) ||
64486448
(isa<ExtractElementInst>(U) && MustGather.contains(U));
64496449
});

0 commit comments

Comments
 (0)