[PATCH] D142670: [LV] Allow forcing tail folding when constructing the cost model (WIP).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 14:16:01 PST 2023
fhahn created this revision.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.
This may help to simplify D142015 <https://reviews.llvm.org/D142015> in combination with D142669 <https://reviews.llvm.org/D142669>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142670
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1162,18 +1162,17 @@
/// different operations.
class LoopVectorizationCostModel {
public:
- LoopVectorizationCostModel(ScalarEpilogueLowering SEL, Loop *L,
- PredicatedScalarEvolution &PSE, LoopInfo *LI,
- LoopVectorizationLegality *Legal,
- const TargetTransformInfo &TTI,
- const TargetLibraryInfo *TLI, DemandedBits *DB,
- AssumptionCache *AC,
- OptimizationRemarkEmitter *ORE, const Function *F,
- const LoopVectorizeHints *Hints,
- InterleavedAccessInfo &IAI)
+ LoopVectorizationCostModel(
+ ScalarEpilogueLowering SEL, Loop *L, PredicatedScalarEvolution &PSE,
+ LoopInfo *LI, LoopVectorizationLegality *Legal,
+ const TargetTransformInfo &TTI, const TargetLibraryInfo *TLI,
+ DemandedBits *DB, AssumptionCache *AC, OptimizationRemarkEmitter *ORE,
+ const Function *F, const LoopVectorizeHints *Hints,
+ InterleavedAccessInfo &IAI, bool ForceFoldTailByMasking = false)
: ScalarEpilogueStatus(SEL), TheLoop(L), PSE(PSE), LI(LI), Legal(Legal),
TTI(TTI), TLI(TLI), DB(DB), AC(AC), ORE(ORE), TheFunction(F),
- Hints(Hints), InterleaveInfo(IAI) {}
+ Hints(Hints), InterleaveInfo(IAI),
+ FoldTailByMasking(ForceFoldTailByMasking) {}
/// \return An upper bound for the vectorization factors (both fixed and
/// scalable). If the factors are 0, vectorization and interleaving should be
@@ -1714,9 +1713,6 @@
/// iterations to execute in the scalar loop.
ScalarEpilogueLowering ScalarEpilogueStatus = CM_ScalarEpilogueAllowed;
- /// All blocks of loop are to be masked to fold tail of scalar iterations.
- bool FoldTailByMasking = false;
-
/// A map holding scalar costs for different vectorization factors. The
/// presence of a cost for an instruction in the mapping indicates that the
/// instruction will be scalarized when vectorizing with the associated
@@ -1854,6 +1850,9 @@
/// with the same stride and close to each other.
InterleavedAccessInfo &InterleaveInfo;
+ /// All blocks of loop are to be masked to fold tail of scalar iterations.
+ bool FoldTailByMasking;
+
/// Values to ignore in the cost model.
SmallPtrSet<const Value *, 16> ValuesToIgnore;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142670.492567.patch
Type: text/x-patch
Size: 2630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/46804854/attachment.bin>
More information about the llvm-commits
mailing list