Skip to content

Commit a7a4daa

Browse files
authored
[LV][NFC] Improve readability with bool instead of auto (#111532)
1 parent b9754e9 commit a7a4daa

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,7 +3206,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
32063206

32073207
// Determine if all users of the induction variable are scalar after
32083208
// vectorization.
3209-
auto ScalarInd = llvm::all_of(Ind->users(), [&](User *U) -> bool {
3209+
bool ScalarInd = all_of(Ind->users(), [&](User *U) -> bool {
32103210
auto *I = cast<Instruction>(U);
32113211
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
32123212
IsDirectLoadStoreFromPtrIndvar(Ind, I);
@@ -3223,12 +3223,11 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
32233223

32243224
// Determine if all users of the induction variable update instruction are
32253225
// scalar after vectorization.
3226-
auto ScalarIndUpdate =
3227-
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
3228-
auto *I = cast<Instruction>(U);
3229-
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
3230-
IsDirectLoadStoreFromPtrIndvar(IndUpdate, I);
3231-
});
3226+
bool ScalarIndUpdate = all_of(IndUpdate->users(), [&](User *U) -> bool {
3227+
auto *I = cast<Instruction>(U);
3228+
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
3229+
IsDirectLoadStoreFromPtrIndvar(IndUpdate, I);
3230+
});
32323231
if (!ScalarIndUpdate)
32333232
continue;
32343233

@@ -3651,11 +3650,10 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
36513650
if (IsOutOfScope(V))
36523651
continue;
36533652
auto *I = cast<Instruction>(V);
3654-
auto UsersAreMemAccesses =
3655-
llvm::all_of(I->users(), [&](User *U) -> bool {
3656-
auto *UI = cast<Instruction>(U);
3657-
return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V);
3658-
});
3653+
bool UsersAreMemAccesses = all_of(I->users(), [&](User *U) -> bool {
3654+
auto *UI = cast<Instruction>(U);
3655+
return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V);
3656+
});
36593657
if (UsersAreMemAccesses)
36603658
AddToWorklistIfAllowed(I);
36613659
}
@@ -3700,7 +3698,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
37003698

37013699
// Determine if all users of the induction variable are uniform after
37023700
// vectorization.
3703-
auto UniformInd = llvm::all_of(Ind->users(), [&](User *U) -> bool {
3701+
bool UniformInd = all_of(Ind->users(), [&](User *U) -> bool {
37043702
auto *I = cast<Instruction>(U);
37053703
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
37063704
IsVectorizedMemAccessUse(I, Ind);
@@ -3710,12 +3708,11 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
37103708

37113709
// Determine if all users of the induction variable update instruction are
37123710
// uniform after vectorization.
3713-
auto UniformIndUpdate =
3714-
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
3715-
auto *I = cast<Instruction>(U);
3716-
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
3717-
IsVectorizedMemAccessUse(I, IndUpdate);
3718-
});
3711+
bool UniformIndUpdate = all_of(IndUpdate->users(), [&](User *U) -> bool {
3712+
auto *I = cast<Instruction>(U);
3713+
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
3714+
IsVectorizedMemAccessUse(I, IndUpdate);
3715+
});
37193716
if (!UniformIndUpdate)
37203717
continue;
37213718

0 commit comments

Comments
 (0)