[llvm] a7a4daa - [LV][NFC] Improve readability with `bool` instead of `auto` (#111532)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 03:30:22 PDT 2024
Author: Piotr Fusik
Date: 2024-10-10T12:30:18+02:00
New Revision: a7a4daa429bb7b0601b4066713fb5b97748212ee
URL: https://github.com/llvm/llvm-project/commit/a7a4daa429bb7b0601b4066713fb5b97748212ee
DIFF: https://github.com/llvm/llvm-project/commit/a7a4daa429bb7b0601b4066713fb5b97748212ee.diff
LOG: [LV][NFC] Improve readability with `bool` instead of `auto` (#111532)
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 517175c8afeef0..db650b23e271e2 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3206,7 +3206,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
// Determine if all users of the induction variable are scalar after
// vectorization.
- auto ScalarInd = llvm::all_of(Ind->users(), [&](User *U) -> bool {
+ bool ScalarInd = all_of(Ind->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
IsDirectLoadStoreFromPtrIndvar(Ind, I);
@@ -3223,12 +3223,11 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
// Determine if all users of the induction variable update instruction are
// scalar after vectorization.
- auto ScalarIndUpdate =
- llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
- auto *I = cast<Instruction>(U);
- return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
- IsDirectLoadStoreFromPtrIndvar(IndUpdate, I);
- });
+ bool ScalarIndUpdate = all_of(IndUpdate->users(), [&](User *U) -> bool {
+ auto *I = cast<Instruction>(U);
+ return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
+ IsDirectLoadStoreFromPtrIndvar(IndUpdate, I);
+ });
if (!ScalarIndUpdate)
continue;
@@ -3651,11 +3650,10 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
if (IsOutOfScope(V))
continue;
auto *I = cast<Instruction>(V);
- auto UsersAreMemAccesses =
- llvm::all_of(I->users(), [&](User *U) -> bool {
- auto *UI = cast<Instruction>(U);
- return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V);
- });
+ bool UsersAreMemAccesses = all_of(I->users(), [&](User *U) -> bool {
+ auto *UI = cast<Instruction>(U);
+ return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V);
+ });
if (UsersAreMemAccesses)
AddToWorklistIfAllowed(I);
}
@@ -3700,7 +3698,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
// Determine if all users of the induction variable are uniform after
// vectorization.
- auto UniformInd = llvm::all_of(Ind->users(), [&](User *U) -> bool {
+ bool UniformInd = all_of(Ind->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
IsVectorizedMemAccessUse(I, Ind);
@@ -3710,12 +3708,11 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
// Determine if all users of the induction variable update instruction are
// uniform after vectorization.
- auto UniformIndUpdate =
- llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
- auto *I = cast<Instruction>(U);
- return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
- IsVectorizedMemAccessUse(I, IndUpdate);
- });
+ bool UniformIndUpdate = all_of(IndUpdate->users(), [&](User *U) -> bool {
+ auto *I = cast<Instruction>(U);
+ return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
+ IsVectorizedMemAccessUse(I, IndUpdate);
+ });
if (!UniformIndUpdate)
continue;
More information about the llvm-commits
mailing list