Skip to content

[llvm] Use llvm::is_contained (NFC) #101855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6229,10 +6229,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
&Call);
break;
}
Check(llvm::any_of(CBR->getIndirectDests(),
[LandingPadBB](const BasicBlock *IndDest) {
return IndDest == LandingPadBB;
}),
Check(llvm::is_contained(CBR->getIndirectDests(), LandingPadBB),
"Intrinsic's corresponding callbr must have intrinsic's parent basic "
"block in indirect destination list",
&Call);
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Utils/LoopSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ static void placeSplitBlockCarefully(BasicBlock *NewBB,
Loop *L) {
// Check to see if NewBB is already well placed.
Function::iterator BBI = --NewBB->getIterator();
for (BasicBlock *Pred : SplitPreds) {
if (&*BBI == Pred)
return;
}
if (llvm::is_contained(SplitPreds, &*BBI))
return;

// If it isn't already after an outside block, move it after one. This is
// always good as it makes the uncond branch from the outside block into a
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Utils/ValueMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ void Mapper::remapDbgRecord(DbgRecord &DR) {
return;

// Otherwise, do some replacement.
if (!IgnoreMissingLocals &&
llvm::any_of(NewVals, [&](Value *V) { return V == nullptr; })) {
if (!IgnoreMissingLocals && llvm::is_contained(NewVals, nullptr)) {
V.setKillLocation();
} else {
// Either we have all non-empty NewVals, or we're permitted to ignore
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Vectorize/VectorCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,7 @@ bool VectorCombine::foldShuffleOfBinops(Instruction &I) {
return false;

// Don't introduce poison into div/rem.
if (any_of(OldMask, [](int M) { return M == PoisonMaskElem; }) &&
B0->isIntDivRem())
if (llvm::is_contained(OldMask, PoisonMaskElem) && B0->isIntDivRem())
return false;

// TODO: Add support for addlike etc.
Expand Down
Loading