[llvm] 7776798 - [LV] Use IsaPred in a few more places (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 1 10:48:20 PST 2024
Author: Florian Hahn
Date: 2024-12-01T18:47:53Z
New Revision: 77767986ed423f868805d8ee9652f6dcc85c6adc
URL: https://github.com/llvm/llvm-project/commit/77767986ed423f868805d8ee9652f6dcc85c6adc
DIFF: https://github.com/llvm/llvm-project/commit/77767986ed423f868805d8ee9652f6dcc85c6adc.diff
LOG: [LV] Use IsaPred in a few more places (NFC).
Simplifies the code slightly by removing explicit lambdas.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 78a3d7216f87e3..90312c1a28df3c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3153,9 +3153,8 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
// If the use of the pointer will be a scalar use, and all users of the
// pointer are memory accesses, place the pointer in ScalarPtrs. Otherwise,
// place the pointer in PossibleNonScalarPtrs.
- if (IsScalarUse(MemAccess, Ptr) && llvm::all_of(I->users(), [&](User *U) {
- return isa<LoadInst>(U) || isa<StoreInst>(U);
- }))
+ if (IsScalarUse(MemAccess, Ptr) &&
+ all_of(I->users(), IsaPred<LoadInst, StoreInst>))
ScalarPtrs.insert(I);
else
PossibleNonScalarPtrs.insert(I);
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index ba791c679b4ae4..1b333bdc30ff17 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -1157,9 +1157,8 @@ void VPlanTransforms::truncateToMinimalBitwidths(
continue;
auto *UV = dyn_cast_or_null<Instruction>(Op->getUnderlyingValue());
if (UV && MinBWs.contains(UV) && !ProcessedTruncs.contains(Op) &&
- all_of(Op->users(), [](VPUser *U) {
- return !isa<VPWidenRecipe, VPWidenSelectRecipe>(U);
- })) {
+ none_of(Op->users(),
+ IsaPred<VPWidenRecipe, VPWidenSelectRecipe>)) {
// Add an entry to ProcessedTruncs to avoid counting the same
// operand multiple times.
ProcessedTruncs[Op] = nullptr;
@@ -1593,10 +1592,9 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
// The transform updates all users of inductions to work based on EVL, instead
// of the VF directly. At the moment, widened inductions cannot be updated, so
// bail out if the plan contains any.
- bool ContainsWidenInductions = any_of(Header->phis(), [](VPRecipeBase &Phi) {
- return isa<VPWidenIntOrFpInductionRecipe, VPWidenPointerInductionRecipe>(
- &Phi);
- });
+ bool ContainsWidenInductions = any_of(
+ Header->phis(),
+ IsaPred<VPWidenIntOrFpInductionRecipe, VPWidenPointerInductionRecipe>);
if (ContainsWidenInductions)
return false;
More information about the llvm-commits
mailing list