forked from OSchip/llvm-project
[llvm] Call *set::insert without checking membership first (NFC)
This commit is contained in:
parent
3766992291
commit
b254d67160
|
@ -658,9 +658,8 @@ llvm::computeMinimumValueSizes(ArrayRef<BasicBlock *> Blocks, DemandedBits &DB,
|
|||
Value *Val = Worklist.pop_back_val();
|
||||
Value *Leader = ECs.getOrInsertLeaderValue(Val);
|
||||
|
||||
if (Visited.count(Val))
|
||||
if (!Visited.insert(Val).second)
|
||||
continue;
|
||||
Visited.insert(Val);
|
||||
|
||||
// Non-instructions terminate a chain successfully.
|
||||
if (!isa<Instruction>(Val))
|
||||
|
|
|
@ -340,9 +340,8 @@ Liveness::getAllReachingDefsRecImpl(RegisterRef RefRR, NodeAddr<RefNode*> RefA,
|
|||
if (!(DA.Addr->getFlags() & NodeAttrs::PhiRef))
|
||||
continue;
|
||||
NodeAddr<PhiNode*> PA = DA.Addr->getOwner(DFG);
|
||||
if (Visited.count(PA.Id))
|
||||
if (!Visited.insert(PA.Id).second)
|
||||
continue;
|
||||
Visited.insert(PA.Id);
|
||||
// Go over all phi uses and get the reaching defs for each use.
|
||||
for (auto U : PA.Addr->members_if(DFG.IsRef<NodeAttrs::Use>, DFG)) {
|
||||
const auto &T = getAllReachingDefsRecImpl(RefRR, U, Visited, TmpDefs,
|
||||
|
|
|
@ -720,9 +720,8 @@ void SelectOptimize::getExclBackwardsSlice(Instruction *I,
|
|||
Worklist.pop();
|
||||
|
||||
// Avoid cycles.
|
||||
if (Visited.count(II))
|
||||
if (!Visited.insert(II).second)
|
||||
continue;
|
||||
Visited.insert(II);
|
||||
|
||||
if (!II->hasOneUse())
|
||||
continue;
|
||||
|
|
|
@ -2021,9 +2021,8 @@ JITDylib::getDFSLinkOrder(ArrayRef<JITDylibSP> JDs) {
|
|||
|
||||
for (auto &KV : llvm::reverse(Result.back()->LinkOrder)) {
|
||||
auto &JD = *KV.first;
|
||||
if (Visited.count(&JD))
|
||||
if (!Visited.insert(&JD).second)
|
||||
continue;
|
||||
Visited.insert(&JD);
|
||||
WorkStack.push_back(&JD);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4725,9 +4725,8 @@ struct MDTreeAsmWriterContext : public AsmWriterContext {
|
|||
: AsmWriterContext(TP, ST, M), Level(0U), Visited({InitMD}), MainOS(OS) {}
|
||||
|
||||
void onWriteMetadataAsOperand(const Metadata *MD) override {
|
||||
if (Visited.count(MD))
|
||||
if (!Visited.insert(MD).second)
|
||||
return;
|
||||
Visited.insert(MD);
|
||||
|
||||
std::string Str;
|
||||
raw_string_ostream SS(Str);
|
||||
|
|
|
@ -177,9 +177,8 @@ static bool tryInterleave(Instruction *Start,
|
|||
// Truncs
|
||||
case Instruction::Trunc:
|
||||
case Instruction::FPTrunc:
|
||||
if (Truncs.count(I))
|
||||
if (!Truncs.insert(I))
|
||||
continue;
|
||||
Truncs.insert(I);
|
||||
Visited.insert(I);
|
||||
break;
|
||||
|
||||
|
@ -236,9 +235,8 @@ static bool tryInterleave(Instruction *Start,
|
|||
case Instruction::FAdd:
|
||||
case Instruction::FMul:
|
||||
case Instruction::Select:
|
||||
if (Ops.count(I))
|
||||
if (!Ops.insert(I))
|
||||
continue;
|
||||
Ops.insert(I);
|
||||
|
||||
for (Use &Op : I->operands()) {
|
||||
if (!isa<FixedVectorType>(Op->getType()))
|
||||
|
|
|
@ -1056,9 +1056,8 @@ void BT::runEdgeQueue(BitVector &BlockScanned) {
|
|||
CFGEdge Edge = FlowQ.front();
|
||||
FlowQ.pop();
|
||||
|
||||
if (EdgeExec.count(Edge))
|
||||
if (!EdgeExec.insert(Edge).second)
|
||||
return;
|
||||
EdgeExec.insert(Edge);
|
||||
ReachedBB.insert(Edge.second);
|
||||
|
||||
const MachineBasicBlock &B = *MF.getBlockNumbered(Edge.second);
|
||||
|
|
|
@ -1152,9 +1152,8 @@ bool PolynomialMultiplyRecognize::findCycle(Value *Out, Value *In,
|
|||
if (IsPhi && HadPhi)
|
||||
return false;
|
||||
HadPhi |= IsPhi;
|
||||
if (Cycle.count(I))
|
||||
if (!Cycle.insert(I))
|
||||
return false;
|
||||
Cycle.insert(I);
|
||||
if (findCycle(I, In, Cycle))
|
||||
break;
|
||||
Cycle.remove(I);
|
||||
|
|
|
@ -73,9 +73,8 @@ WebAssemblyLateEHPrepare::getMatchingEHPad(MachineInstr *MI) {
|
|||
MachineBasicBlock *EHPad = nullptr;
|
||||
while (!WL.empty()) {
|
||||
MachineBasicBlock *MBB = WL.pop_back_val();
|
||||
if (Visited.count(MBB))
|
||||
if (!Visited.insert(MBB).second)
|
||||
continue;
|
||||
Visited.insert(MBB);
|
||||
if (MBB->isEHPad()) {
|
||||
if (EHPad && EHPad != MBB)
|
||||
return nullptr;
|
||||
|
|
|
@ -3140,9 +3140,8 @@ bool NewGVN::singleReachablePHIPath(
|
|||
// connected component finding in this routine, and it's probably not worth
|
||||
// the complexity for the time being. So, we just keep a set of visited
|
||||
// MemoryAccess and return true when we hit a cycle.
|
||||
if (Visited.count(First))
|
||||
if (!Visited.insert(First).second)
|
||||
return true;
|
||||
Visited.insert(First);
|
||||
|
||||
const auto *EndDef = First;
|
||||
for (auto *ChainDef : optimized_def_chain(First)) {
|
||||
|
|
|
@ -172,9 +172,8 @@ static void visitRegisterBankClasses(
|
|||
SmallPtrSetImpl<const CodeGenRegisterClass *> &VisitedRCs) {
|
||||
|
||||
// Make sure we only visit each class once to avoid infinite loops.
|
||||
if (VisitedRCs.count(RC))
|
||||
if (!VisitedRCs.insert(RC).second)
|
||||
return;
|
||||
VisitedRCs.insert(RC);
|
||||
|
||||
// Visit each explicitly named class.
|
||||
VisitFn(RC, Kind.str());
|
||||
|
|
Loading…
Reference in New Issue