[llvm] bd404fb - [LV][NFC] Fix the condition for printing debug messages
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 15 01:50:07 PDT 2022
Author: Mel Chen
Date: 2022-07-15T01:47:33-07:00
New Revision: bd404fbcc804ab06fbe29e27984d82a74450c34b
URL: https://github.com/llvm/llvm-project/commit/bd404fbcc804ab06fbe29e27984d82a74450c34b
DIFF: https://github.com/llvm/llvm-project/commit/bd404fbcc804ab06fbe29e27984d82a74450c34b.diff
LOG: [LV][NFC] Fix the condition for printing debug messages
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D128523
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/RISCV/force-vect-msg.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0777a13859169..d897b247a41e3 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5406,7 +5406,7 @@ VectorizationFactor LoopVectorizationCostModel::selectVectorizationFactor(
}
LLVM_DEBUG(if (ForceVectorization && !ChosenFactor.Width.isScalar() &&
- ChosenFactor.Cost >= ScalarCost.Cost) dbgs()
+ !isMoreProfitable(ChosenFactor, ScalarCost)) dbgs()
<< "LV: Vectorization seems to be not beneficial, "
<< "but was forced by a user.\n");
LLVM_DEBUG(dbgs() << "LV: Selecting VF: " << ChosenFactor.Width << ".\n");
diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/force-vect-msg.ll b/llvm/test/Transforms/LoopVectorize/RISCV/force-vect-msg.ll
index 1c470a3d7ebbc..cad00f6d0c4e5 100644
--- a/llvm/test/Transforms/LoopVectorize/RISCV/force-vect-msg.ll
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/force-vect-msg.ll
@@ -3,8 +3,11 @@
; CHECK: LV: Loop hints: force=enabled
; CHECK: LV: Scalar loop costs: 7.
+; ChosenFactor.Cost is 8, but the real cost will be divided by the width, which is 4.
; CHECK: LV: Vector loop of width 2 costs: 4.
-; CHECK: LV: Vectorization seems to be not beneficial, but was forced by a user.
+; Regardless of force vectorization or not, this loop will eventually be vectorized because of the cost model.
+; Therefore, the following message does not need to be printed even if vectorization is explicitly forced in the metadata.
+; CHECK-NOT: LV: Vectorization seems to be not beneficial, but was forced by a user.
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
target triple = "riscv64-unknown-unknown"
More information about the llvm-commits
mailing list