Skip to content

Commit 7776798

Browse files
committed
[LV] Use IsaPred in a few more places (NFC).
Simplifies the code slightly by removing explicit lambdas.
1 parent 31bde71 commit 7776798

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,9 +3153,8 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
31533153
// If the use of the pointer will be a scalar use, and all users of the
31543154
// pointer are memory accesses, place the pointer in ScalarPtrs. Otherwise,
31553155
// place the pointer in PossibleNonScalarPtrs.
3156-
if (IsScalarUse(MemAccess, Ptr) && llvm::all_of(I->users(), [&](User *U) {
3157-
return isa<LoadInst>(U) || isa<StoreInst>(U);
3158-
}))
3156+
if (IsScalarUse(MemAccess, Ptr) &&
3157+
all_of(I->users(), IsaPred<LoadInst, StoreInst>))
31593158
ScalarPtrs.insert(I);
31603159
else
31613160
PossibleNonScalarPtrs.insert(I);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,9 +1157,8 @@ void VPlanTransforms::truncateToMinimalBitwidths(
11571157
continue;
11581158
auto *UV = dyn_cast_or_null<Instruction>(Op->getUnderlyingValue());
11591159
if (UV && MinBWs.contains(UV) && !ProcessedTruncs.contains(Op) &&
1160-
all_of(Op->users(), [](VPUser *U) {
1161-
return !isa<VPWidenRecipe, VPWidenSelectRecipe>(U);
1162-
})) {
1160+
none_of(Op->users(),
1161+
IsaPred<VPWidenRecipe, VPWidenSelectRecipe>)) {
11631162
// Add an entry to ProcessedTruncs to avoid counting the same
11641163
// operand multiple times.
11651164
ProcessedTruncs[Op] = nullptr;
@@ -1593,10 +1592,9 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
15931592
// The transform updates all users of inductions to work based on EVL, instead
15941593
// of the VF directly. At the moment, widened inductions cannot be updated, so
15951594
// bail out if the plan contains any.
1596-
bool ContainsWidenInductions = any_of(Header->phis(), [](VPRecipeBase &Phi) {
1597-
return isa<VPWidenIntOrFpInductionRecipe, VPWidenPointerInductionRecipe>(
1598-
&Phi);
1599-
});
1595+
bool ContainsWidenInductions = any_of(
1596+
Header->phis(),
1597+
IsaPred<VPWidenIntOrFpInductionRecipe, VPWidenPointerInductionRecipe>);
16001598
if (ContainsWidenInductions)
16011599
return false;
16021600

0 commit comments

Comments
 (0)