LLVM  15.0.0git
LoopVectorizationPlanner.h
Go to the documentation of this file.
1 //===- LoopVectorizationPlanner.h - Planner for LoopVectorization ---------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file provides a LoopVectorizationPlanner class.
11 /// InnerLoopVectorizer vectorizes loops which contain only one basic
12 /// LoopVectorizationPlanner - drives the vectorization process after having
13 /// passed Legality checks.
14 /// The planner builds and optimizes the Vectorization Plans which record the
15 /// decisions how to vectorize the given loop. In particular, represent the
16 /// control-flow of the vectorized version, the replication of instructions that
17 /// are to be scalarized, and interleave access groups.
18 ///
19 /// Also provides a VPlan-based builder utility analogous to IRBuilder.
20 /// It provides an instruction-level API for generating VPInstructions while
21 /// abstracting away the Recipe manipulation details.
22 //===----------------------------------------------------------------------===//
23 
24 #ifndef LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONPLANNER_H
25 #define LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONPLANNER_H
26 
27 #include "VPlan.h"
29 
30 namespace llvm {
31 
32 class LoopInfo;
33 class LoopVectorizationLegality;
34 class LoopVectorizationCostModel;
35 class PredicatedScalarEvolution;
36 class LoopVectorizationRequirements;
37 class LoopVectorizeHints;
38 class OptimizationRemarkEmitter;
39 class TargetTransformInfo;
40 class TargetLibraryInfo;
41 class VPRecipeBuilder;
42 
43 /// VPlan-based builder utility analogous to IRBuilder.
44 class VPBuilder {
45  VPBasicBlock *BB = nullptr;
47 
48  VPInstruction *createInstruction(unsigned Opcode,
50  VPInstruction *Instr = new VPInstruction(Opcode, Operands, DL);
51  if (BB)
52  BB->insert(Instr, InsertPt);
53  return Instr;
54  }
55 
56  VPInstruction *createInstruction(unsigned Opcode,
57  std::initializer_list<VPValue *> Operands,
58  DebugLoc DL) {
59  return createInstruction(Opcode, ArrayRef<VPValue *>(Operands), DL);
60  }
61 
62 public:
63  VPBuilder() = default;
64 
65  /// Clear the insertion point: created instructions will not be inserted into
66  /// a block.
68  BB = nullptr;
69  InsertPt = VPBasicBlock::iterator();
70  }
71 
72  VPBasicBlock *getInsertBlock() const { return BB; }
73  VPBasicBlock::iterator getInsertPoint() const { return InsertPt; }
74 
75  /// InsertPoint - A saved insertion point.
76  class VPInsertPoint {
77  VPBasicBlock *Block = nullptr;
79 
80  public:
81  /// Creates a new insertion point which doesn't point to anything.
82  VPInsertPoint() = default;
83 
84  /// Creates a new insertion point at the given location.
86  : Block(InsertBlock), Point(InsertPoint) {}
87 
88  /// Returns true if this insert point is set.
89  bool isSet() const { return Block != nullptr; }
90 
91  VPBasicBlock *getBlock() const { return Block; }
92  VPBasicBlock::iterator getPoint() const { return Point; }
93  };
94 
95  /// Sets the current insert point to a previously-saved location.
97  if (IP.isSet())
98  setInsertPoint(IP.getBlock(), IP.getPoint());
99  else
101  }
102 
103  /// This specifies that created VPInstructions should be appended to the end
104  /// of the specified block.
106  assert(TheBB && "Attempting to set a null insert point");
107  BB = TheBB;
108  InsertPt = BB->end();
109  }
110 
111  /// This specifies that created instructions should be inserted at the
112  /// specified point.
114  BB = TheBB;
115  InsertPt = IP;
116  }
117 
118  /// Insert and return the specified instruction.
120  BB->insert(I, InsertPt);
121  return I;
122  }
123 
124  /// Create an N-ary operation with \p Opcode, \p Operands and set \p Inst as
125  /// its underlying Instruction.
127  Instruction *Inst = nullptr) {
128  DebugLoc DL;
129  if (Inst)
130  DL = Inst->getDebugLoc();
131  VPInstruction *NewVPInst = createInstruction(Opcode, Operands, DL);
132  NewVPInst->setUnderlyingValue(Inst);
133  return NewVPInst;
134  }
136  DebugLoc DL) {
137  return createInstruction(Opcode, Operands, DL);
138  }
139 
141  return createInstruction(VPInstruction::Not, {Operand}, DL);
142  }
143 
145  return createInstruction(Instruction::BinaryOps::And, {LHS, RHS}, DL);
146  }
147 
149  return createInstruction(Instruction::BinaryOps::Or, {LHS, RHS}, DL);
150  }
151 
153  DebugLoc DL) {
155  }
156 
157  //===--------------------------------------------------------------------===//
158  // RAII helpers.
159  //===--------------------------------------------------------------------===//
160 
161  /// RAII object that stores the current insertion point and restores it when
162  /// the object is destroyed.
164  VPBuilder &Builder;
165  VPBasicBlock *Block;
167 
168  public:
170  : Builder(B), Block(B.getInsertBlock()), Point(B.getInsertPoint()) {}
171 
172  InsertPointGuard(const InsertPointGuard &) = delete;
173  InsertPointGuard &operator=(const InsertPointGuard &) = delete;
174 
175  ~InsertPointGuard() { Builder.restoreIP(VPInsertPoint(Block, Point)); }
176  };
177 };
178 
179 /// TODO: The following VectorizationFactor was pulled out of
180 /// LoopVectorizationCostModel class. LV also deals with
181 /// VectorizerParams::VectorizationFactor and VectorizationCostTy.
182 /// We need to streamline them.
183 
184 /// Information about vectorization costs.
186  /// Vector width with best cost.
188  /// Cost of the loop with that width.
190 
191  /// Cost of the scalar loop.
193 
197 
198  /// Width 1 means no vectorization, cost 0 means uncomputed cost.
200  return {ElementCount::getFixed(1), 0, 0};
201  }
202 
203  bool operator==(const VectorizationFactor &rhs) const {
204  return Width == rhs.Width && Cost == rhs.Cost;
205  }
206 
207  bool operator!=(const VectorizationFactor &rhs) const {
208  return !(*this == rhs);
209  }
210 };
211 
212 /// A class that represents two vectorization factors (initialized with 0 by
213 /// default). One for fixed-width vectorization and one for scalable
214 /// vectorization. This can be used by the vectorizer to choose from a range of
215 /// fixed and/or scalable VFs in order to find the most cost-effective VF to
216 /// vectorize with.
220 
222  : FixedVF(ElementCount::getFixed(0)),
223  ScalableVF(ElementCount::getScalable(0)) {}
225  *(Max.isScalable() ? &ScalableVF : &FixedVF) = Max;
226  }
228  const ElementCount &ScalableVF)
231  "Invalid scalable properties");
232  }
233 
235 
236  /// \return true if either fixed- or scalable VF is non-zero.
237  explicit operator bool() const { return FixedVF || ScalableVF; }
238 
239  /// \return true if either fixed- or scalable VF is a valid vector VF.
240  bool hasVector() const { return FixedVF.isVector() || ScalableVF.isVector(); }
241 };
242 
243 /// Planner drives the vectorization process after having passed
244 /// Legality checks.
246  /// The loop that we evaluate.
247  Loop *OrigLoop;
248 
249  /// Loop Info analysis.
250  LoopInfo *LI;
251 
252  /// Target Library Info.
253  const TargetLibraryInfo *TLI;
254 
255  /// Target Transform Info.
256  const TargetTransformInfo *TTI;
257 
258  /// The legality analysis.
260 
261  /// The profitability analysis.
263 
264  /// The interleaved access analysis.
266 
268 
269  const LoopVectorizeHints &Hints;
270 
271  LoopVectorizationRequirements &Requirements;
272 
274 
276 
277  /// A builder used to construct the current plan.
278  VPBuilder Builder;
279 
280 public:
282  const TargetTransformInfo *TTI,
287  const LoopVectorizeHints &Hints,
288  LoopVectorizationRequirements &Requirements,
290  : OrigLoop(L), LI(LI), TLI(TLI), TTI(TTI), Legal(Legal), CM(CM), IAI(IAI),
291  PSE(PSE), Hints(Hints), Requirements(Requirements), ORE(ORE) {}
292 
293  /// Plan how to best vectorize, return the best VF and its cost, or None if
294  /// vectorization and interleaving should be avoided up front.
295  Optional<VectorizationFactor> plan(ElementCount UserVF, unsigned UserIC);
296 
297  /// Use the VPlan-native path to plan how to best vectorize, return the best
298  /// VF and its cost.
300 
301  /// Return the best VPlan for \p VF.
302  VPlan &getBestPlanFor(ElementCount VF) const;
303 
304  /// Generate the IR code for the body of the vectorized loop according to the
305  /// best selected \p VF, \p UF and VPlan \p BestPlan.
306  /// TODO: \p IsEpilogueVectorization is needed to avoid issues due to epilogue
307  /// vectorization re-using plans for both the main and epilogue vector loops.
308  /// It should be removed once the re-use issue has been fixed.
309  void executePlan(ElementCount VF, unsigned UF, VPlan &BestPlan,
311  bool IsEpilogueVectorization);
312 
313 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
314  void printPlans(raw_ostream &O);
315 #endif
316 
317  /// Look through the existing plans and return true if we have one with all
318  /// the vectorization factors in question.
319  bool hasPlanWithVF(ElementCount VF) const {
320  return any_of(VPlans,
321  [&](const VPlanPtr &Plan) { return Plan->hasVF(VF); });
322  }
323 
324  /// Test a \p Predicate on a \p Range of VF's. Return the value of applying
325  /// \p Predicate on Range.Start, possibly decreasing Range.End such that the
326  /// returned value holds for the entire \p Range.
327  static bool
329  VFRange &Range);
330 
331  /// Check if the number of runtime checks exceeds the threshold.
332  bool requiresTooManyRuntimeChecks() const;
333 
334 protected:
335  /// Collect the instructions from the original loop that would be trivially
336  /// dead in the vectorized loop if generated.
338  SmallPtrSetImpl<Instruction *> &DeadInstructions);
339 
340  /// Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive,
341  /// according to the information gathered by Legal when it checked if it is
342  /// legal to vectorize the loop.
343  void buildVPlans(ElementCount MinVF, ElementCount MaxVF);
344 
345 private:
346  /// Build a VPlan according to the information gathered by Legal. \return a
347  /// VPlan for vectorization factors \p Range.Start and up to \p Range.End
348  /// exclusive, possibly decreasing \p Range.End.
349  VPlanPtr buildVPlan(VFRange &Range);
350 
351  /// Build a VPlan using VPRecipes according to the information gather by
352  /// Legal. This method is only used for the legacy inner loop vectorizer.
353  VPlanPtr buildVPlanWithVPRecipes(
354  VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions,
355  const MapVector<Instruction *, Instruction *> &SinkAfter);
356 
357  /// Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive,
358  /// according to the information gathered by Legal when it checked if it is
359  /// legal to vectorize the loop. This method creates VPlans using VPRecipes.
360  void buildVPlansWithVPRecipes(ElementCount MinVF, ElementCount MaxVF);
361 
362  // Adjust the recipes for reductions. For in-loop reductions the chain of
363  // instructions leading from the loop exit instr to the phi need to be
364  // converted to reductions, with one operand being vector and the other being
365  // the scalar reduction chain. For other reductions, a select is introduced
366  // between the phi and live-out recipes when folding the tail.
367  void adjustRecipesForReductions(VPBasicBlock *LatchVPBB, VPlanPtr &Plan,
368  VPRecipeBuilder &RecipeBuilder,
369  ElementCount MinVF);
370 };
371 
372 } // namespace llvm
373 
374 #endif // LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONPLANNER_H
llvm::InstructionCost
Definition: InstructionCost.h:29
llvm::VPBuilder::getInsertBlock
VPBasicBlock * getInsertBlock() const
Definition: LoopVectorizationPlanner.h:72
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::FixedScalableVFPair
A class that represents two vectorization factors (initialized with 0 by default).
Definition: LoopVectorizationPlanner.h:217
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair(const ElementCount &Max)
Definition: LoopVectorizationPlanner.h:224
llvm::LoopVectorizationPlanner::collectTriviallyDeadInstructions
void collectTriviallyDeadInstructions(SmallPtrSetImpl< Instruction * > &DeadInstructions)
Collect the instructions from the original loop that would be trivially dead in the vectorized loop i...
Definition: LoopVectorize.cpp:7588
llvm::VPBuilder::createNaryOp
VPValue * createNaryOp(unsigned Opcode, ArrayRef< VPValue * > Operands, Instruction *Inst=nullptr)
Create an N-ary operation with Opcode, Operands and set Inst as its underlying Instruction.
Definition: LoopVectorizationPlanner.h:126
llvm::VPBuilder::VPInsertPoint::VPInsertPoint
VPInsertPoint()=default
Creates a new insertion point which doesn't point to anything.
llvm::ElementCount
Definition: TypeSize.h:404
llvm::VPBasicBlock
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:1967
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:546
llvm::FixedScalableVFPair::getNone
static FixedScalableVFPair getNone()
Definition: LoopVectorizationPlanner.h:234
llvm::VPBuilder::createNot
VPValue * createNot(VPValue *Operand, DebugLoc DL)
Definition: LoopVectorizationPlanner.h:140
llvm::VPBuilder::createOr
VPValue * createOr(VPValue *LHS, VPValue *RHS, DebugLoc DL)
Definition: LoopVectorizationPlanner.h:148
llvm::PredicatedScalarEvolution
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
Definition: ScalarEvolution.h:2184
llvm::SmallVector< VPlanPtr, 4 >
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:168
llvm::LoopVectorizationLegality
LoopVectorizationLegality checks if it is legal to vectorize a loop, and to what vectorization factor...
Definition: LoopVectorizationLegality.h:248
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:166
llvm::VPBuilder::InsertPointGuard::operator=
InsertPointGuard & operator=(const InsertPointGuard &)=delete
llvm::VPlanPtr
std::unique_ptr< VPlan > VPlanPtr
Definition: VPlan.h:99
llvm::VPBuilder::getInsertPoint
VPBasicBlock::iterator getInsertPoint() const
Definition: LoopVectorizationPlanner.h:73
llvm::Optional
Definition: APInt.h:33
llvm::LoopVectorizationPlanner::plan
Optional< VectorizationFactor > plan(ElementCount UserVF, unsigned UserIC)
Plan how to best vectorize, return the best VF and its cost, or None if vectorization and interleavin...
Definition: LoopVectorize.cpp:7375
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
llvm::tgtok::FalseVal
@ FalseVal
Definition: TGLexer.h:62
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair(const ElementCount &FixedVF, const ElementCount &ScalableVF)
Definition: LoopVectorizationPlanner.h:227
llvm::VPRecipeBuilder
Helper class to create VPRecipies from IR instructions.
Definition: VPRecipeBuilder.h:27
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::VectorizationFactor::operator==
bool operator==(const VectorizationFactor &rhs) const
Definition: LoopVectorizationPlanner.h:203
llvm::LinearPolySize::isScalable
bool isScalable() const
Returns whether the size is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:298
llvm::VectorizationFactor::operator!=
bool operator!=(const VectorizationFactor &rhs) const
Definition: LoopVectorizationPlanner.h:207
llvm::VFRange
A range of powers-of-2 vectorization factors with fixed start and adjustable end.
Definition: VPlan.h:79
llvm::LoopVectorizationCostModel
LoopVectorizationCostModel - estimates the expected speedups due to vectorization.
Definition: LoopVectorize.cpp:1126
llvm::LoopVectorizationRequirements
This holds vectorization requirements that must be verified late in the process.
Definition: LoopVectorizationLegality.h:214
llvm::VPBasicBlock::iterator
RecipeListTy::iterator iterator
Instruction iterators...
Definition: VPlan.h:1988
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::LoopVectorizationPlanner::executePlan
void executePlan(ElementCount VF, unsigned UF, VPlan &BestPlan, InnerLoopVectorizer &LB, DominatorTree *DT, bool IsEpilogueVectorization)
Generate the IR code for the body of the vectorized loop according to the best selected VF,...
Definition: LoopVectorize.cpp:7492
llvm::VPInstruction
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:771
llvm::VPBuilder
VPlan-based builder utility analogous to IRBuilder.
Definition: LoopVectorizationPlanner.h:44
llvm::FixedScalableVFPair::hasVector
bool hasVector() const
Definition: LoopVectorizationPlanner.h:240
llvm::LoopVectorizationPlanner::buildVPlans
void buildVPlans(ElementCount MinVF, ElementCount MaxVF)
Build VPlans for power-of-2 VF's between MinVF and MaxVF inclusive, according to the information gath...
Definition: LoopVectorize.cpp:7933
IP
Definition: NVPTXLowerArgs.cpp:167
llvm::FixedScalableVFPair::FixedVF
ElementCount FixedVF
Definition: LoopVectorizationPlanner.h:218
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::VectorizationFactor::VectorizationFactor
VectorizationFactor(ElementCount Width, InstructionCost Cost, InstructionCost ScalarCost)
Definition: LoopVectorizationPlanner.h:194
llvm::Instruction
Definition: Instruction.h:42
llvm::InterleavedAccessInfo
Drive the analysis of interleaved memory accesses in the loop.
Definition: VectorUtils.h:751
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::VPValue
Definition: VPlanValue.h:44
VPlan.h
llvm::InnerLoopVectorizer
InnerLoopVectorizer vectorizes loops which contain only one basic block to a specified vectorization ...
Definition: LoopVectorize.cpp:438
llvm::LinearPolySize< ElementCount >::getFixed
static ElementCount getFixed(ScalarTy MinVal)
Definition: TypeSize.h:283
llvm::LoopVectorizationPlanner
Planner drives the vectorization process after having passed Legality checks.
Definition: LoopVectorizationPlanner.h:245
llvm::VectorizationFactor::Cost
InstructionCost Cost
Cost of the loop with that width.
Definition: LoopVectorizationPlanner.h:189
llvm::VPBuilder::insert
VPInstruction * insert(VPInstruction *I) const
Insert and return the specified instruction.
Definition: LoopVectorizationPlanner.h:119
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:74
llvm::VectorizationFactor::ScalarCost
InstructionCost ScalarCost
Cost of the scalar loop.
Definition: LoopVectorizationPlanner.h:192
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:240
llvm::PPC::Predicate
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
Definition: PPCPredicates.h:26
llvm::LoopVectorizeHints
Utility class for getting and setting loop vectorizer hints in the form of loop metadata.
Definition: LoopVectorizationLegality.h:61
llvm::IRSimilarity::Legal
@ Legal
Definition: IRSimilarityIdentifier.h:76
llvm::VPInstruction::Not
@ Not
Definition: VPlan.h:780
llvm::VPBuilder::VPInsertPoint::getBlock
VPBasicBlock * getBlock() const
Definition: LoopVectorizationPlanner.h:91
llvm::VPBuilder::InsertPointGuard::~InsertPointGuard
~InsertPointGuard()
Definition: LoopVectorizationPlanner.h:175
llvm::LoopVectorizationPlanner::LoopVectorizationPlanner
LoopVectorizationPlanner(Loop *L, LoopInfo *LI, const TargetLibraryInfo *TLI, const TargetTransformInfo *TTI, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, InterleavedAccessInfo &IAI, PredicatedScalarEvolution &PSE, const LoopVectorizeHints &Hints, LoopVectorizationRequirements &Requirements, OptimizationRemarkEmitter *ORE)
Definition: LoopVectorizationPlanner.h:281
I
#define I(x, y, z)
Definition: MD5.cpp:58
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::VPBuilder::InsertPointGuard
RAII object that stores the current insertion point and restores it when the object is destroyed.
Definition: LoopVectorizationPlanner.h:163
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::ElementCount::isVector
bool isVector() const
One or more elements.
Definition: TypeSize.h:416
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::VPBuilder::setInsertPoint
void setInsertPoint(VPBasicBlock *TheBB, VPBasicBlock::iterator IP)
This specifies that created instructions should be inserted at the specified point.
Definition: LoopVectorizationPlanner.h:113
InstructionCost.h
llvm::LoopVectorizationPlanner::requiresTooManyRuntimeChecks
bool requiresTooManyRuntimeChecks() const
Check if the number of runtime checks exceeds the threshold.
Definition: LoopVectorize.cpp:7366
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::LoopInfo
Definition: LoopInfo.h:1102
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1624
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:137
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::VPBuilder::createSelect
VPValue * createSelect(VPValue *Cond, VPValue *TrueVal, VPValue *FalseVal, DebugLoc DL)
Definition: LoopVectorizationPlanner.h:152
llvm::VPValue::setUnderlyingValue
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:77
llvm::VPBuilder::createAnd
VPValue * createAnd(VPValue *LHS, VPValue *RHS, DebugLoc DL)
Definition: LoopVectorizationPlanner.h:144
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:164
llvm::LoopVectorizationPlanner::printPlans
void printPlans(raw_ostream &O)
Definition: LoopVectorize.cpp:7579
llvm::VPBuilder::clearInsertionPoint
void clearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
Definition: LoopVectorizationPlanner.h:67
llvm::VectorizationFactor
TODO: The following VectorizationFactor was pulled out of LoopVectorizationCostModel class.
Definition: LoopVectorizationPlanner.h:185
llvm::FixedScalableVFPair::ScalableVF
ElementCount ScalableVF
Definition: LoopVectorizationPlanner.h:219
llvm::VPBuilder::VPInsertPoint
InsertPoint - A saved insertion point.
Definition: LoopVectorizationPlanner.h:76
llvm::VPBuilder::VPBuilder
VPBuilder()=default
llvm::VPBuilder::restoreIP
void restoreIP(VPInsertPoint IP)
Sets the current insert point to a previously-saved location.
Definition: LoopVectorizationPlanner.h:96
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:222
llvm::VPBuilder::VPInsertPoint::VPInsertPoint
VPInsertPoint(VPBasicBlock *InsertBlock, VPBasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
Definition: LoopVectorizationPlanner.h:85
llvm::VPBuilder::InsertPointGuard::InsertPointGuard
InsertPointGuard(VPBuilder &B)
Definition: LoopVectorizationPlanner.h:169
llvm::VectorizationFactor::Width
ElementCount Width
Vector width with best cost.
Definition: LoopVectorizationPlanner.h:187
llvm::LoopVectorizationPlanner::planInVPlanNativePath
VectorizationFactor planInVPlanNativePath(ElementCount UserVF)
Use the VPlan-native path to plan how to best vectorize, return the best VF and its cost.
Definition: LoopVectorize.cpp:7322
llvm::VPBuilder::setInsertPoint
void setInsertPoint(VPBasicBlock *TheBB)
This specifies that created VPInstructions should be appended to the end of the specified block.
Definition: LoopVectorizationPlanner.h:105
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair()
Definition: LoopVectorizationPlanner.h:221
llvm::VPBuilder::VPInsertPoint::getPoint
VPBasicBlock::iterator getPoint() const
Definition: LoopVectorizationPlanner.h:92
llvm::LoopVectorizationPlanner::hasPlanWithVF
bool hasPlanWithVF(ElementCount VF) const
Look through the existing plans and return true if we have one with all the vectorization factors in ...
Definition: LoopVectorizationPlanner.h:319
llvm::SmallPtrSetImpl< Instruction * >
llvm::VPBuilder::createNaryOp
VPValue * createNaryOp(unsigned Opcode, ArrayRef< VPValue * > Operands, DebugLoc DL)
Definition: LoopVectorizationPlanner.h:135
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::tgtok::TrueVal
@ TrueVal
Definition: TGLexer.h:62
llvm::VPBuilder::VPInsertPoint::isSet
bool isSet() const
Returns true if this insert point is set.
Definition: LoopVectorizationPlanner.h:89
llvm::VPlan
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:2446
llvm::LoopVectorizationPlanner::getDecisionAndClampRange
static bool getDecisionAndClampRange(const std::function< bool(ElementCount)> &Predicate, VFRange &Range)
Test a Predicate on a Range of VF's.
Definition: LoopVectorize.cpp:7913
llvm::LoopVectorizationPlanner::getBestPlanFor
VPlan & getBestPlanFor(ElementCount VF) const
Return the best VPlan for VF.
Definition: LoopVectorize.cpp:7445
llvm::VectorizationFactor::Disabled
static VectorizationFactor Disabled()
Width 1 means no vectorization, cost 0 means uncomputed cost.
Definition: LoopVectorizationPlanner.h:199