auto *BB = Worklist.pop_back_val();
Set.insert(BB);
for (auto *Pred : predecessors(BB))
- if (Set.count(Pred) == 0)
+ if (!Set.contains(Pred))
Worklist.push_back(Pred);
}
// Breaks non-convergent assumption if CS is a convergent call to a function
// not in the SCC.
return CB && CB->isConvergent() &&
- SCCNodes.count(CB->getCalledFunction()) == 0;
+ !SCCNodes.contains(CB->getCalledFunction());
}
/// Helper for NoUnwind inference predicate InstrBreaksAttribute.
findUsedValues(M.getGlobalVariable("llvm.compiler.used"), llvmUsedValues);
for (GlobalVariable &GV : M.globals()) {
- if (GV.hasLocalLinkage() && llvmUsedValues.count(&GV) == 0)
+ if (GV.hasLocalLinkage() && !llvmUsedValues.contains(&GV))
if (!PreserveDbgInfo || !GV.getName().startswith("llvm.dbg"))
GV.setName(""); // Internal symbols can't participate in linkage
}
for (Function &I : M) {
- if (I.hasLocalLinkage() && llvmUsedValues.count(&I) == 0)
+ if (I.hasLocalLinkage() && !llvmUsedValues.contains(&I))
if (!PreserveDbgInfo || !I.getName().startswith("llvm.dbg"))
I.setName(""); // Internal symbols can't participate in linkage
if (auto *Symtab = I.getValueSymbolTable())
// As long as the user is another old PHI node, then even if we don't
// rewrite it, the PHI web we're considering won't have any users
// outside itself, so it'll be dead.
- if (OldPhiNodes.count(PHI) == 0)
+ if (!OldPhiNodes.contains(PHI))
return nullptr;
} else {
return nullptr;
if (!CI->isNoopCast(DL))
return false;
- if (Explored.count(CI->getOperand(0)) == 0)
+ if (!Explored.contains(CI->getOperand(0)))
WorkList.push_back(CI->getOperand(0));
}
GEP->getType() != Start->getType())
return false;
- if (Explored.count(GEP->getOperand(0)) == 0)
+ if (!Explored.contains(GEP->getOperand(0)))
WorkList.push_back(GEP->getOperand(0));
}
// Explore the PHI nodes further.
for (auto *PN : PHIs)
for (Value *Op : PN->incoming_values())
- if (Explored.count(Op) == 0)
+ if (!Explored.contains(Op))
WorkList.push_back(Op);
}
auto *Inst = dyn_cast<Instruction>(Val);
if (Inst == Base || Inst == PHI || !Inst || !PHI ||
- Explored.count(PHI) == 0)
+ !Explored.contains(PHI))
continue;
if (PHI->getParent() == Inst->getParent())
SI->swapValues();
SI->swapProfMetadata();
if (Scope->TrueBiasedSelects.count(SI)) {
- assert(Scope->FalseBiasedSelects.count(SI) == 0 &&
+ assert(!Scope->FalseBiasedSelects.contains(SI) &&
"Must not be already in");
Scope->FalseBiasedSelects.insert(SI);
} else if (Scope->FalseBiasedSelects.count(SI)) {
- assert(Scope->TrueBiasedSelects.count(SI) == 0 &&
+ assert(!Scope->TrueBiasedSelects.contains(SI) &&
"Must not be already in");
Scope->TrueBiasedSelects.insert(SI);
}
SmallVector<Instruction *, 8> Users;
for (User *U : I.users()) {
if (auto *UI = dyn_cast<Instruction>(U)) {
- if (BlocksInScope.count(UI->getParent()) == 0 &&
+ if (!BlocksInScope.contains(UI->getParent()) &&
// Unless there's already a phi for I at the exit block.
!(isa<PHINode>(UI) && UI->getParent() == ExitBlock)) {
CHR_DEBUG(dbgs() << "V " << I << "\n");
// If it does, transformation would be illegal.
//
// Don't count the roots, as they terminate the graphs.
- if (Roots.count(I) == 0) {
+ if (!Roots.contains(I)) {
// Set the type of the conversion while we're here.
if (!ConvertedToTy)
ConvertedToTy = I->getType();
for (BasicBlock *B : L->blocks())
for (Instruction &I : *B)
- if (IgnoredInsts.count(&I) == 0 &&
+ if (!IgnoredInsts.contains(&I) &&
isModOrRefSet(
intersectModRef(AA.getModRefInfo(&I, StoreLoc), Access)))
return true;
auto &OuterInnerReductions = LIL.getOuterInnerReductions();
// Now update the reduction PHIs in the inner and outer loop headers.
SmallVector<PHINode *, 4> InnerLoopPHIs, OuterLoopPHIs;
- for (PHINode &PHI : InnerLoopHeader->phis()) {
- if (OuterInnerReductions.find(&PHI) == OuterInnerReductions.end())
- continue;
- InnerLoopPHIs.push_back(cast<PHINode>(&PHI));
- }
- for (PHINode &PHI : OuterLoopHeader->phis()) {
- if (OuterInnerReductions.find(&PHI) == OuterInnerReductions.end())
- continue;
- OuterLoopPHIs.push_back(cast<PHINode>(&PHI));
- }
+ for (PHINode &PHI : InnerLoopHeader->phis())
+ if (OuterInnerReductions.contains(&PHI))
+ InnerLoopPHIs.push_back(cast<PHINode>(&PHI));
+ for (PHINode &PHI : OuterLoopHeader->phis())
+ if (OuterInnerReductions.contains(&PHI))
+ OuterLoopPHIs.push_back(cast<PHINode>(&PHI));
// Now move the remaining reduction PHIs from outer to inner loop header and
// vice versa. The PHI nodes must be part of a reduction across the inner and
// Skip uses in unreachable blocks, as we're going
// to delete them.
- if (ReachableBlocks.count(IBlock) == 0)
+ if (!ReachableBlocks.contains(IBlock))
continue;
DomTreeNode *DomNode = DT->getNode(IBlock);
if (const auto *DVI = dyn_cast<DbgVariableIntrinsic>(U)) {
return all_of(DVI->location_ops(), [&NotHoisted](Value *V) {
if (const auto *I = dyn_cast_or_null<Instruction>(V)) {
- if (NotHoisted.count(I) == 0)
+ if (!NotHoisted.contains(I))
return true;
}
return false;
// children to a new vector.
auto FirstChild = std::partition(
CandidateLoops.begin(), CandidateLoops.end(), [&](Loop *L) {
- return L == NewLoop || Blocks.count(L->getHeader()) == 0;
+ return L == NewLoop || !Blocks.contains(L->getHeader());
});
SmallVector<Loop *, 8> ChildLoops(FirstChild, CandidateLoops.end());
CandidateLoops.erase(FirstChild, CandidateLoops.end());
// of \param BB (BB4) and should not have address-taken.
// There should exist only one such unconditional
// branch among the predecessors.
- if (UnCondBlock || !PP || (Preds.count(PP) == 0) ||
+ if (UnCondBlock || !PP || !Preds.contains(PP) ||
Pred->hasAddressTaken())
return false;
// PS is the successor which is not BB. Check successors to identify
// the last conditional branch.
- if (Preds.count(PS) == 0) {
+ if (!Preds.contains(PS)) {
// Case 2.
LastCondBlock = Pred;
} else {
unsigned NumPHIdValues = 0;
for (auto *I : *LRI)
for (auto *V : PHIOperands[I]) {
- if (InstructionsToSink.count(V) == 0)
+ if (!InstructionsToSink.contains(V))
++NumPHIdValues;
// FIXME: this check is overly optimistic. We may end up not sinking
// said instruction, due to the very same profitability check.