[llvm] d7ef34b - [LV] update comment following 63d8058 (NFC) (#91120)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 02:59:30 PDT 2024
Author: Ramkumar Ramachandra
Date: 2024-05-14T10:59:26+01:00
New Revision: d7ef34bfe3d432ffd66a05fc9fcc87fd6c3db2ee
URL: https://github.com/llvm/llvm-project/commit/d7ef34bfe3d432ffd66a05fc9fcc87fd6c3db2ee
DIFF: https://github.com/llvm/llvm-project/commit/d7ef34bfe3d432ffd66a05fc9fcc87fd6c3db2ee.diff
LOG: [LV] update comment following 63d8058 (NFC) (#91120)
Address a review comment post landing 63d8058 (LoopVectorize: guard
appending InstsToScalarize; fix bug) to update a comment.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index ba02c98285c33..9353666e417c8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5813,10 +5813,11 @@ void LoopVectorizationCostModel::collectInstsToScalarize(ElementCount VF) {
for (Instruction &I : *BB)
if (isScalarWithPredication(&I, VF)) {
ScalarCostsTy ScalarCosts;
- // Do not apply discount if scalable, because that would lead to
- // invalid scalarization costs.
- // Do not apply discount logic if hacked cost is needed
- // for emulated masked memrefs.
+ // Do not apply discount logic for:
+ // 1. Scalars after vectorization, as there will only be a single copy
+ // of the instruction.
+ // 2. Scalable VF, as that would lead to invalid scalarization costs.
+ // 3. Emulated masked memrefs, if a hacked cost is needed.
if (!isScalarAfterVectorization(&I, VF) && !VF.isScalable() &&
!useEmulatedMaskMemRefHack(&I, VF) &&
computePredInstDiscount(&I, ScalarCosts, VF) >= 0)
More information about the llvm-commits
mailing list