aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMadhur Amilkanthwar <madhura@nvidia.com>2024-09-04 16:28:39 +0530
committerGitHub <noreply@github.com>2024-09-04 16:28:39 +0530
commitcd46829e547d2d0aa3cb0ef7c9de59c507eaaecc (patch)
tree342edea55e23a29c680fd783794379b1c45de804 /llvm/lib/Transforms
parent6d3563422ce6f431b837221932d32db4c9681fc5 (diff)
downloadllvm-cd46829e547d2d0aa3cb0ef7c9de59c507eaaecc.zip
llvm-cd46829e547d2d0aa3cb0ef7c9de59c507eaaecc.tar.gz
llvm-cd46829e547d2d0aa3cb0ef7c9de59c507eaaecc.tar.bz2
[LV] Fix emission of debug message in legality check (#101924)
Successful vectorization message is emitted even after "Result" is false. "Result" = false indicates failure of one of the legality check and thus successful message should not be printed.
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index 66a779d..7042af6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -1451,10 +1451,12 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {
// Check whether the loop-related control flow in the loop nest is expected by
// vectorizer.
if (!canVectorizeLoopNestCFG(TheLoop, UseVPlanNativePath)) {
- if (DoExtraAnalysis)
+ if (DoExtraAnalysis) {
+ LLVM_DEBUG(dbgs() << "LV: legality check failed: loop nest");
Result = false;
- else
+ } else {
return false;
+ }
}
// We need to have a loop header.
@@ -1519,17 +1521,21 @@ bool LoopVectorizationLegality::canVectorize(bool UseVPlanNativePath) {
return false;
}
- LLVM_DEBUG(dbgs() << "LV: We can vectorize this loop"
- << (LAI->getRuntimePointerChecking()->Need
- ? " (with a runtime bound check)"
- : "")
- << "!\n");
+ if (Result) {
+ LLVM_DEBUG(dbgs() << "LV: We can vectorize this loop"
+ << (LAI->getRuntimePointerChecking()->Need
+ ? " (with a runtime bound check)"
+ : "")
+ << "!\n");
+ }
unsigned SCEVThreshold = VectorizeSCEVCheckThreshold;
if (Hints->getForce() == LoopVectorizeHints::FK_Enabled)
SCEVThreshold = PragmaVectorizeSCEVCheckThreshold;
if (PSE.getPredicate().getComplexity() > SCEVThreshold) {
+ LLVM_DEBUG(dbgs() << "LV: Vectorization not profitable "
+ "due to SCEVThreshold");
reportVectorizationFailure("Too many SCEV checks needed",
"Too many SCEV assumptions need to be made and checked at runtime",
"TooManySCEVRunTimeChecks", ORE, TheLoop);