Skip to content

Commit b7c5e0b

Browse files
[Target, Transforms] Use *Set::contains (NFC)
1 parent 55f0a1b commit b7c5e0b

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

llvm/lib/Analysis/DomTreeUpdater.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ bool DomTreeUpdater::hasPendingPostDomTreeUpdates() const {
166166
bool DomTreeUpdater::isBBPendingDeletion(llvm::BasicBlock *DelBB) const {
167167
if (Strategy == UpdateStrategy::Eager || DeletedBBs.empty())
168168
return false;
169-
return DeletedBBs.count(DelBB) != 0;
169+
return DeletedBBs.contains(DelBB);
170170
}
171171

172172
// The DT and PDT require the nodes related to updates

llvm/lib/CodeGen/LexicalScopes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) {
324324
Set = std::make_unique<BlockSetT>();
325325
getMachineBasicBlocks(DL, *Set);
326326
}
327-
return Set->count(MBB) != 0;
327+
return Set->contains(MBB);
328328
}
329329

330330
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

llvm/lib/CodeGen/LiveVariables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
666666
// other part of the code generator if this happens.
667667
#ifndef NDEBUG
668668
for(MachineFunction::iterator i = MF->begin(), e = MF->end(); i != e; ++i)
669-
assert(Visited.count(&*i) != 0 && "unreachable basic block found");
669+
assert(Visited.contains(&*i) && "unreachable basic block found");
670670
#endif
671671

672672
PhysRegDef.clear();

llvm/lib/CodeGen/MachinePipeliner.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,12 +1595,12 @@ static bool computePath(SUnit *Cur, SetVector<SUnit *> &Path,
15951595
SmallPtrSet<SUnit *, 8> &Visited) {
15961596
if (Cur->isBoundaryNode())
15971597
return false;
1598-
if (Exclude.count(Cur) != 0)
1598+
if (Exclude.contains(Cur))
15991599
return false;
1600-
if (DestNodes.count(Cur) != 0)
1600+
if (DestNodes.contains(Cur))
16011601
return true;
16021602
if (!Visited.insert(Cur).second)
1603-
return Path.count(Cur) != 0;
1603+
return Path.contains(Cur);
16041604
bool FoundPath = false;
16051605
for (auto &SI : Cur->Succs)
16061606
FoundPath |= computePath(SI.getSUnit(), Path, DestNodes, Exclude, Visited);
@@ -1956,7 +1956,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
19561956
for (const auto &I : maxHeight->Succs) {
19571957
if (Nodes.count(I.getSUnit()) == 0)
19581958
continue;
1959-
if (NodeOrder.count(I.getSUnit()) != 0)
1959+
if (NodeOrder.contains(I.getSUnit()))
19601960
continue;
19611961
if (ignoreDependence(I, false))
19621962
continue;
@@ -1968,7 +1968,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
19681968
continue;
19691969
if (Nodes.count(I.getSUnit()) == 0)
19701970
continue;
1971-
if (NodeOrder.count(I.getSUnit()) != 0)
1971+
if (NodeOrder.contains(I.getSUnit()))
19721972
continue;
19731973
R.insert(I.getSUnit());
19741974
}
@@ -2007,7 +2007,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
20072007
for (const auto &I : maxDepth->Preds) {
20082008
if (Nodes.count(I.getSUnit()) == 0)
20092009
continue;
2010-
if (NodeOrder.count(I.getSUnit()) != 0)
2010+
if (NodeOrder.contains(I.getSUnit()))
20112011
continue;
20122012
R.insert(I.getSUnit());
20132013
}
@@ -2017,7 +2017,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
20172017
continue;
20182018
if (Nodes.count(I.getSUnit()) == 0)
20192019
continue;
2020-
if (NodeOrder.count(I.getSUnit()) != 0)
2020+
if (NodeOrder.contains(I.getSUnit()))
20212021
continue;
20222022
R.insert(I.getSUnit());
20232023
}

llvm/lib/CodeGen/MachineSink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ void MachineSinking::ProcessDbgInst(MachineInstr &MI) {
462462

463463
DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(),
464464
MI.getDebugLoc()->getInlinedAt());
465-
bool SeenBefore = SeenDbgVars.count(Var) != 0;
465+
bool SeenBefore = SeenDbgVars.contains(Var);
466466

467467
MachineOperand &MO = MI.getDebugOperand(0);
468468
if (MO.isReg() && MO.getReg().isVirtual())

llvm/lib/CodeGen/RegAllocPBQP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ class Interference : public PBQPRAConstraint {
230230
return false;
231231

232232
if (NRegs < MRegs)
233-
return D.count(IKey(NRegs, MRegs)) > 0;
233+
return D.contains(IKey(NRegs, MRegs));
234234

235-
return D.count(IKey(MRegs, NRegs)) > 0;
235+
return D.contains(IKey(MRegs, NRegs));
236236
}
237237

238238
void setDisjointAllowedRegs(const PBQPRAGraph &G, PBQPRAGraph::NodeId NId,

llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,11 +984,11 @@ void LinearizedRegion::addMBBs(LinearizedRegion *InnerRegion) {
984984
}
985985

986986
bool LinearizedRegion::contains(MachineBasicBlock *MBB) {
987-
return MBBs.count(MBB) == 1;
987+
return MBBs.contains(MBB);
988988
}
989989

990990
bool LinearizedRegion::isLiveOut(unsigned Reg) {
991-
return LiveOuts.count(Reg) == 1;
991+
return LiveOuts.contains(Reg);
992992
}
993993

994994
bool LinearizedRegion::hasNoDef(unsigned Reg, MachineRegisterInfo *MRI) {

llvm/lib/Target/PowerPC/PPCMacroFusion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class FusionFeature {
5151
Kd(Kind), Supported(HasFeature), DepOpIdx(Index), OpSet1(First),
5252
OpSet2(Second) {}
5353

54-
bool hasOp1(unsigned Opc) const { return OpSet1.count(Opc) != 0; }
55-
bool hasOp2(unsigned Opc) const { return OpSet2.count(Opc) != 0; }
54+
bool hasOp1(unsigned Opc) const { return OpSet1.contains(Opc); }
55+
bool hasOp2(unsigned Opc) const { return OpSet2.contains(Opc); }
5656
bool isSupported() const { return Supported; }
5757
Optional<unsigned> depOpIdx() const {
5858
if (DepOpIdx < 0)

llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
281281

282282
for (const Value *V : U->operand_values()) {
283283
if (const Instruction *I = dyn_cast<Instruction>(V)) {
284-
if (NotHoisted.count(I) > 0)
284+
if (NotHoisted.contains(I))
285285
return false;
286286
}
287287
}

0 commit comments

Comments
 (0)