-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LoopVectorize] Use new single string variant of reportVectorizationFailure #120414
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: David Sherwood (david-arm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/120414.diff 3 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index 555c8435dd330d..0c4b5cec3988d8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -666,7 +666,6 @@ bool LoopVectorizationLegality::canVectorizeOuterLoop() {
// Check whether we are able to set up outer loop induction.
if (!setupOuterLoopInductions()) {
reportVectorizationFailure("Unsupported outer loop Phi(s)",
- "Unsupported outer loop Phi(s)",
"UnsupportedPhi", ORE, TheLoop);
if (DoExtraAnalysis)
Result = false;
@@ -962,7 +961,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
Type *T = ST->getValueOperand()->getType();
if (!VectorType::isValidElementType(T)) {
reportVectorizationFailure("Store instruction cannot be vectorized",
- "store instruction cannot be vectorized",
"CantVectorizeStore", ORE, TheLoop, ST);
return false;
}
@@ -975,7 +973,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
assert(VecTy && "did not find vectorized version of stored type");
if (!TTI->isLegalNTStore(VecTy, ST->getAlign())) {
reportVectorizationFailure(
- "nontemporal store instruction cannot be vectorized",
"nontemporal store instruction cannot be vectorized",
"CantVectorizeNontemporalStore", ORE, TheLoop, ST);
return false;
@@ -990,7 +987,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
assert(VecTy && "did not find vectorized version of load type");
if (!TTI->isLegalNTLoad(VecTy, LD->getAlign())) {
reportVectorizationFailure(
- "nontemporal load instruction cannot be vectorized",
"nontemporal load instruction cannot be vectorized",
"CantVectorizeNontemporalLoad", ORE, TheLoop, LD);
return false;
@@ -1020,7 +1016,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
continue;
}
reportVectorizationFailure("Value cannot be used outside the loop",
- "value cannot be used outside the loop",
"ValueUsedOutsideLoop", ORE, TheLoop, &I);
return false;
}
@@ -1442,7 +1437,6 @@ bool LoopVectorizationLegality::blockCanBePredicated(
bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (!EnableIfConversion) {
reportVectorizationFailure("If-conversion is disabled",
- "if-conversion is disabled",
"IfConversionDisabled",
ORE, TheLoop);
return false;
@@ -1493,14 +1487,12 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (isa<SwitchInst>(BB->getTerminator())) {
if (TheLoop->isLoopExiting(BB)) {
reportVectorizationFailure("Loop contains an unsupported switch",
- "loop contains an unsupported switch",
"LoopContainsUnsupportedSwitch", ORE,
TheLoop, BB->getTerminator());
return false;
}
} else if (!isa<BranchInst>(BB->getTerminator())) {
reportVectorizationFailure("Loop contains an unsupported terminator",
- "loop contains an unsupported terminator",
"LoopContainsUnsupportedTerminator", ORE,
TheLoop, BB->getTerminator());
return false;
@@ -1510,8 +1502,7 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (blockNeedsPredication(BB) &&
!blockCanBePredicated(BB, SafePointers, MaskedOp)) {
reportVectorizationFailure(
- "Control flow cannot be substituted for a select",
- "control flow cannot be substituted for a select", "NoCFGForSelect",
+ "Control flow cannot be substituted for a select", "NoCFGForSelect",
ORE, TheLoop, BB->getTerminator());
return false;
}
@@ -1700,8 +1691,6 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
return false;
} else if (!IsSafeOperation(&I)) {
reportVectorizationFailure("Early exit loop contains operations that "
- "cannot be speculatively executed",
- "Early exit loop contains operations that "
"cannot be speculatively executed",
"UnsafeOperationsEarlyExitLoop", ORE,
TheLoop);
@@ -1764,7 +1753,6 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {
if (!canVectorizeOuterLoop()) {
reportVectorizationFailure("Unsupported outer loop",
- "unsupported outer loop",
"UnsupportedOuterLoop",
ORE, TheLoop);
// TODO: Implement DoExtraAnalysis when subsequent legal checks support
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index a6acc710a34c89..a5a43c3c0f0e68 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4265,7 +4265,6 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
if (TC == 0) {
reportVectorizationFailure(
- "Unable to calculate the loop count due to complex control flow",
"unable to calculate the loop count due to complex control flow",
"UnknownLoopCountComplexCFG", ORE, TheLoop);
return FixedScalableVFPair::getNone();
@@ -9350,7 +9349,6 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
addExitUsersForFirstOrderRecurrences(*Plan, ExitUsersToFix);
if (!addUsersInExitBlocks(*Plan, ExitUsersToFix)) {
reportVectorizationFailure(
- "Some exit values in loop with uncountable exit not supported yet",
"Some exit values in loop with uncountable exit not supported yet",
"UncountableEarlyExitLoopsUnsupportedExitValue", ORE, OrigLoop);
return nullptr;
diff --git a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
index 99911b251c81e1..4c0317e300f190 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
@@ -41,7 +41,7 @@
; }
; return k;
; }
-; CHECK: remark: source.cpp:29:7: loop not vectorized: control flow cannot be substituted for a select
+; CHECK: remark: source.cpp:29:7: loop not vectorized: Control flow cannot be substituted for a select
; CHECK: remark: source.cpp:27:3: loop not vectorized
; YAML: --- !Analysis
@@ -104,7 +104,7 @@
; YAML-NEXT: Function: test_multiple_failures
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'loop not vectorized: '
-; YAML-NEXT: - String: control flow cannot be substituted for a select
+; YAML-NEXT: - String: Control flow cannot be substituted for a select
; YAML-NEXT: ...
; YAML-NEXT: --- !Analysis
; YAML-NEXT: Pass: loop-vectorize
|
@llvm/pr-subscribers-vectorizers Author: David Sherwood (david-arm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/120414.diff 3 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index 555c8435dd330d..0c4b5cec3988d8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -666,7 +666,6 @@ bool LoopVectorizationLegality::canVectorizeOuterLoop() {
// Check whether we are able to set up outer loop induction.
if (!setupOuterLoopInductions()) {
reportVectorizationFailure("Unsupported outer loop Phi(s)",
- "Unsupported outer loop Phi(s)",
"UnsupportedPhi", ORE, TheLoop);
if (DoExtraAnalysis)
Result = false;
@@ -962,7 +961,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
Type *T = ST->getValueOperand()->getType();
if (!VectorType::isValidElementType(T)) {
reportVectorizationFailure("Store instruction cannot be vectorized",
- "store instruction cannot be vectorized",
"CantVectorizeStore", ORE, TheLoop, ST);
return false;
}
@@ -975,7 +973,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
assert(VecTy && "did not find vectorized version of stored type");
if (!TTI->isLegalNTStore(VecTy, ST->getAlign())) {
reportVectorizationFailure(
- "nontemporal store instruction cannot be vectorized",
"nontemporal store instruction cannot be vectorized",
"CantVectorizeNontemporalStore", ORE, TheLoop, ST);
return false;
@@ -990,7 +987,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
assert(VecTy && "did not find vectorized version of load type");
if (!TTI->isLegalNTLoad(VecTy, LD->getAlign())) {
reportVectorizationFailure(
- "nontemporal load instruction cannot be vectorized",
"nontemporal load instruction cannot be vectorized",
"CantVectorizeNontemporalLoad", ORE, TheLoop, LD);
return false;
@@ -1020,7 +1016,6 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
continue;
}
reportVectorizationFailure("Value cannot be used outside the loop",
- "value cannot be used outside the loop",
"ValueUsedOutsideLoop", ORE, TheLoop, &I);
return false;
}
@@ -1442,7 +1437,6 @@ bool LoopVectorizationLegality::blockCanBePredicated(
bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (!EnableIfConversion) {
reportVectorizationFailure("If-conversion is disabled",
- "if-conversion is disabled",
"IfConversionDisabled",
ORE, TheLoop);
return false;
@@ -1493,14 +1487,12 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (isa<SwitchInst>(BB->getTerminator())) {
if (TheLoop->isLoopExiting(BB)) {
reportVectorizationFailure("Loop contains an unsupported switch",
- "loop contains an unsupported switch",
"LoopContainsUnsupportedSwitch", ORE,
TheLoop, BB->getTerminator());
return false;
}
} else if (!isa<BranchInst>(BB->getTerminator())) {
reportVectorizationFailure("Loop contains an unsupported terminator",
- "loop contains an unsupported terminator",
"LoopContainsUnsupportedTerminator", ORE,
TheLoop, BB->getTerminator());
return false;
@@ -1510,8 +1502,7 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
if (blockNeedsPredication(BB) &&
!blockCanBePredicated(BB, SafePointers, MaskedOp)) {
reportVectorizationFailure(
- "Control flow cannot be substituted for a select",
- "control flow cannot be substituted for a select", "NoCFGForSelect",
+ "Control flow cannot be substituted for a select", "NoCFGForSelect",
ORE, TheLoop, BB->getTerminator());
return false;
}
@@ -1700,8 +1691,6 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
return false;
} else if (!IsSafeOperation(&I)) {
reportVectorizationFailure("Early exit loop contains operations that "
- "cannot be speculatively executed",
- "Early exit loop contains operations that "
"cannot be speculatively executed",
"UnsafeOperationsEarlyExitLoop", ORE,
TheLoop);
@@ -1764,7 +1753,6 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {
if (!canVectorizeOuterLoop()) {
reportVectorizationFailure("Unsupported outer loop",
- "unsupported outer loop",
"UnsupportedOuterLoop",
ORE, TheLoop);
// TODO: Implement DoExtraAnalysis when subsequent legal checks support
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index a6acc710a34c89..a5a43c3c0f0e68 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4265,7 +4265,6 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
if (TC == 0) {
reportVectorizationFailure(
- "Unable to calculate the loop count due to complex control flow",
"unable to calculate the loop count due to complex control flow",
"UnknownLoopCountComplexCFG", ORE, TheLoop);
return FixedScalableVFPair::getNone();
@@ -9350,7 +9349,6 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
addExitUsersForFirstOrderRecurrences(*Plan, ExitUsersToFix);
if (!addUsersInExitBlocks(*Plan, ExitUsersToFix)) {
reportVectorizationFailure(
- "Some exit values in loop with uncountable exit not supported yet",
"Some exit values in loop with uncountable exit not supported yet",
"UncountableEarlyExitLoopsUnsupportedExitValue", ORE, OrigLoop);
return nullptr;
diff --git a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
index 99911b251c81e1..4c0317e300f190 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll
@@ -41,7 +41,7 @@
; }
; return k;
; }
-; CHECK: remark: source.cpp:29:7: loop not vectorized: control flow cannot be substituted for a select
+; CHECK: remark: source.cpp:29:7: loop not vectorized: Control flow cannot be substituted for a select
; CHECK: remark: source.cpp:27:3: loop not vectorized
; YAML: --- !Analysis
@@ -104,7 +104,7 @@
; YAML-NEXT: Function: test_multiple_failures
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'loop not vectorized: '
-; YAML-NEXT: - String: control flow cannot be substituted for a select
+; YAML-NEXT: - String: Control flow cannot be substituted for a select
; YAML-NEXT: ...
; YAML-NEXT: --- !Analysis
; YAML-NEXT: Pass: loop-vectorize
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
@@ -666,7 +666,6 @@ bool LoopVectorizationLegality::canVectorizeOuterLoop() { | |||
// Check whether we are able to set up outer loop induction. | |||
if (!setupOuterLoopInductions()) { | |||
reportVectorizationFailure("Unsupported outer loop Phi(s)", | |||
"Unsupported outer loop Phi(s)", |
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.
Small thought - do we want to unify the style for all reportVectorizationFailure
calls to either capitalize or not-capitalize the first word of the string? As currently it looks like it's a mix between both.
Otherwise LGTM, once clang-format is happy.
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.
Yeah it's a good point and I thought about that too. It doesn't look like there is always consistency throughout for all of the reports. I agree it would be good to standardise them. Not sure if @fhahn has any thoughts?
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
Thanks for taking a look. It seems like I need to update my downstream format checking scripts because downstream they pass and upstream they fail. :( |
No description provided.