[Target, Transforms] Use *Set::contains (NFC)

This commit is contained in:
Kazu Hirata 2021-01-08 18:39:53 -08:00
parent 55f0a1b066
commit b7c5e0b02c
9 changed files with 18 additions and 18 deletions

View File

@ -166,7 +166,7 @@ bool DomTreeUpdater::hasPendingPostDomTreeUpdates() const {
bool DomTreeUpdater::isBBPendingDeletion(llvm::BasicBlock *DelBB) const {
if (Strategy == UpdateStrategy::Eager || DeletedBBs.empty())
return false;
return DeletedBBs.count(DelBB) != 0;
return DeletedBBs.contains(DelBB);
}
// The DT and PDT require the nodes related to updates

View File

@ -324,7 +324,7 @@ bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) {
Set = std::make_unique<BlockSetT>();
getMachineBasicBlocks(DL, *Set);
}
return Set->count(MBB) != 0;
return Set->contains(MBB);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

View File

@ -666,7 +666,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
// other part of the code generator if this happens.
#ifndef NDEBUG
for(MachineFunction::iterator i = MF->begin(), e = MF->end(); i != e; ++i)
assert(Visited.count(&*i) != 0 && "unreachable basic block found");
assert(Visited.contains(&*i) && "unreachable basic block found");
#endif
PhysRegDef.clear();

View File

@ -1595,12 +1595,12 @@ static bool computePath(SUnit *Cur, SetVector<SUnit *> &Path,
SmallPtrSet<SUnit *, 8> &Visited) {
if (Cur->isBoundaryNode())
return false;
if (Exclude.count(Cur) != 0)
if (Exclude.contains(Cur))
return false;
if (DestNodes.count(Cur) != 0)
if (DestNodes.contains(Cur))
return true;
if (!Visited.insert(Cur).second)
return Path.count(Cur) != 0;
return Path.contains(Cur);
bool FoundPath = false;
for (auto &SI : Cur->Succs)
FoundPath |= computePath(SI.getSUnit(), Path, DestNodes, Exclude, Visited);
@ -1956,7 +1956,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
for (const auto &I : maxHeight->Succs) {
if (Nodes.count(I.getSUnit()) == 0)
continue;
if (NodeOrder.count(I.getSUnit()) != 0)
if (NodeOrder.contains(I.getSUnit()))
continue;
if (ignoreDependence(I, false))
continue;
@ -1968,7 +1968,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
continue;
if (Nodes.count(I.getSUnit()) == 0)
continue;
if (NodeOrder.count(I.getSUnit()) != 0)
if (NodeOrder.contains(I.getSUnit()))
continue;
R.insert(I.getSUnit());
}
@ -2007,7 +2007,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
for (const auto &I : maxDepth->Preds) {
if (Nodes.count(I.getSUnit()) == 0)
continue;
if (NodeOrder.count(I.getSUnit()) != 0)
if (NodeOrder.contains(I.getSUnit()))
continue;
R.insert(I.getSUnit());
}
@ -2017,7 +2017,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
continue;
if (Nodes.count(I.getSUnit()) == 0)
continue;
if (NodeOrder.count(I.getSUnit()) != 0)
if (NodeOrder.contains(I.getSUnit()))
continue;
R.insert(I.getSUnit());
}

View File

@ -462,7 +462,7 @@ void MachineSinking::ProcessDbgInst(MachineInstr &MI) {
DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(),
MI.getDebugLoc()->getInlinedAt());
bool SeenBefore = SeenDbgVars.count(Var) != 0;
bool SeenBefore = SeenDbgVars.contains(Var);
MachineOperand &MO = MI.getDebugOperand(0);
if (MO.isReg() && MO.getReg().isVirtual())

View File

@ -230,9 +230,9 @@ private:
return false;
if (NRegs < MRegs)
return D.count(IKey(NRegs, MRegs)) > 0;
return D.contains(IKey(NRegs, MRegs));
return D.count(IKey(MRegs, NRegs)) > 0;
return D.contains(IKey(MRegs, NRegs));
}
void setDisjointAllowedRegs(const PBQPRAGraph &G, PBQPRAGraph::NodeId NId,

View File

@ -984,11 +984,11 @@ void LinearizedRegion::addMBBs(LinearizedRegion *InnerRegion) {
}
bool LinearizedRegion::contains(MachineBasicBlock *MBB) {
return MBBs.count(MBB) == 1;
return MBBs.contains(MBB);
}
bool LinearizedRegion::isLiveOut(unsigned Reg) {
return LiveOuts.count(Reg) == 1;
return LiveOuts.contains(Reg);
}
bool LinearizedRegion::hasNoDef(unsigned Reg, MachineRegisterInfo *MRI) {

View File

@ -51,8 +51,8 @@ public:
Kd(Kind), Supported(HasFeature), DepOpIdx(Index), OpSet1(First),
OpSet2(Second) {}
bool hasOp1(unsigned Opc) const { return OpSet1.count(Opc) != 0; }
bool hasOp2(unsigned Opc) const { return OpSet2.count(Opc) != 0; }
bool hasOp1(unsigned Opc) const { return OpSet1.contains(Opc); }
bool hasOp2(unsigned Opc) const { return OpSet2.contains(Opc); }
bool isSupported() const { return Supported; }
Optional<unsigned> depOpIdx() const {
if (DepOpIdx < 0)

View File

@ -281,7 +281,7 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
for (const Value *V : U->operand_values()) {
if (const Instruction *I = dyn_cast<Instruction>(V)) {
if (NotHoisted.count(I) > 0)
if (NotHoisted.contains(I))
return false;
}
}