-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LV][NFC] Improve readability with bool
instead of auto
#111532
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
Conversation
@llvm/pr-subscribers-llvm-transforms Author: Piotr Fusik (pfusik) ChangesFull diff: https://github.com/llvm/llvm-project/pull/111532.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 001c8987667df8..dc0a9fc68cdc4b 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3204,7 +3204,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 = llvm::all_of(Ind->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
IsDirectLoadStoreFromPtrIndvar(Ind, I);
@@ -3221,7 +3221,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
// Determine if all users of the induction variable update instruction are
// scalar after vectorization.
- auto ScalarIndUpdate =
+ bool ScalarIndUpdate =
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
@@ -3649,7 +3649,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
if (IsOutOfScope(V))
continue;
auto *I = cast<Instruction>(V);
- auto UsersAreMemAccesses =
+ bool UsersAreMemAccesses =
llvm::all_of(I->users(), [&](User *U) -> bool {
auto *UI = cast<Instruction>(U);
return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V);
@@ -3698,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 = llvm::all_of(Ind->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == IndUpdate || !TheLoop->contains(I) || Worklist.count(I) ||
IsVectorizedMemAccessUse(I, Ind);
@@ -3708,7 +3708,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
// Determine if all users of the induction variable update instruction are
// uniform after vectorization.
- auto UniformIndUpdate =
+ bool UniformIndUpdate =
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool {
auto *I = cast<Instruction>(U);
return I == Ind || !TheLoop->contains(I) || Worklist.count(I) ||
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
@@ -3204,7 +3204,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 = llvm::all_of(Ind->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are editing the line, might as well drop redundant llvm::
bool ScalarInd = llvm::all_of(Ind->users(), [&](User *U) -> bool { | |
bool ScalarInd = llvm::all_of(Ind->users(), [&](User *U) -> bool { |
auto *UI = cast<Instruction>(U); | ||
return TheLoop->contains(UI) && IsVectorizedMemAccessUse(UI, V); | ||
}); | ||
bool UsersAreMemAccesses = llvm::all_of(I->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are editing the line, might as well drop redundant llvm::
bool UsersAreMemAccesses = llvm::all_of(I->users(), [&](User *U) -> bool { | |
bool UsersAreMemAccesses = all_of(I->users(), [&](User *U) -> bool { |
@@ -3698,7 +3697,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 = llvm::all_of(Ind->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are editing the line, might as well drop redundant llvm::
bool UniformInd = llvm::all_of(Ind->users(), [&](User *U) -> bool { | |
bool UniformInd = all_of(Ind->users(), [&](User *U) -> bool { |
@@ -3221,7 +3221,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) { | |||
|
|||
// Determine if all users of the induction variable update instruction are | |||
// scalar after vectorization. | |||
auto ScalarIndUpdate = | |||
bool ScalarIndUpdate = | |||
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are editing around here, might as well drop redundant llvm::
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool { | |
all_of(IndUpdate->users(), [&](User *U) -> bool { |
@@ -3708,7 +3707,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) { | |||
|
|||
// Determine if all users of the induction variable update instruction are | |||
// uniform after vectorization. | |||
auto UniformIndUpdate = | |||
bool UniformIndUpdate = | |||
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are editing around here, might as well drop redundant llvm::
llvm::all_of(IndUpdate->users(), [&](User *U) -> bool { | |
all_of(IndUpdate->users(), [&](User *U) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
No description provided.