[Target, Transforms] Use *Set::contains (NFC)
diff --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp index e690d64..8ac7d9d 100644 --- a/llvm/lib/Analysis/DomTreeUpdater.cpp +++ b/llvm/lib/Analysis/DomTreeUpdater.cpp
@@ -166,7 +166,7 @@ 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
diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp index 690b429..8139c2c 100644 --- a/llvm/lib/CodeGen/LexicalScopes.cpp +++ b/llvm/lib/CodeGen/LexicalScopes.cpp
@@ -324,7 +324,7 @@ Set = std::make_unique<BlockSetT>(); getMachineBasicBlocks(DL, *Set); } - return Set->count(MBB) != 0; + return Set->contains(MBB); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index 6490a79..49b880c 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp
@@ -666,7 +666,7 @@ // 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();
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index db4d78a..9564192 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1595,12 +1595,12 @@ 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 @@ 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 @@ 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 @@ 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 @@ continue; if (Nodes.count(I.getSUnit()) == 0) continue; - if (NodeOrder.count(I.getSUnit()) != 0) + if (NodeOrder.contains(I.getSUnit())) continue; R.insert(I.getSUnit()); }
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index cede18b..378df1b 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -462,7 +462,7 @@ 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())
diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp index 90e9cb5..7c5af1a 100644 --- a/llvm/lib/CodeGen/RegAllocPBQP.cpp +++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp
@@ -230,9 +230,9 @@ 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,
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp index 5e353c5..d9dba9a 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
@@ -984,11 +984,11 @@ } 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) {
diff --git a/llvm/lib/Target/PowerPC/PPCMacroFusion.cpp b/llvm/lib/Target/PowerPC/PPCMacroFusion.cpp index 815dfd1..d12c6d9 100644 --- a/llvm/lib/Target/PowerPC/PPCMacroFusion.cpp +++ b/llvm/lib/Target/PowerPC/PPCMacroFusion.cpp
@@ -51,8 +51,8 @@ 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)
diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp index 5baab56..c78185f 100644 --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
@@ -281,7 +281,7 @@ 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; } }