LLVM  14.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"
28 
29 namespace llvm {
30 
31 class LoopInfo;
32 class LoopVectorizationLegality;
33 class LoopVectorizationCostModel;
34 class PredicatedScalarEvolution;
35 class LoopVectorizationRequirements;
36 class LoopVectorizeHints;
37 class OptimizationRemarkEmitter;
38 class TargetTransformInfo;
39 class TargetLibraryInfo;
40 class VPRecipeBuilder;
41 
42 /// VPlan-based builder utility analogous to IRBuilder.
43 class VPBuilder {
44  VPBasicBlock *BB = nullptr;
46 
47  VPInstruction *createInstruction(unsigned Opcode,
49  VPInstruction *Instr = new VPInstruction(Opcode, Operands);
50  if (BB)
51  BB->insert(Instr, InsertPt);
52  return Instr;
53  }
54 
55  VPInstruction *createInstruction(unsigned Opcode,
56  std::initializer_list<VPValue *> Operands) {
57  return createInstruction(Opcode, ArrayRef<VPValue *>(Operands));
58  }
59 
60 public:
61  VPBuilder() {}
62 
63  /// Clear the insertion point: created instructions will not be inserted into
64  /// a block.
66  BB = nullptr;
67  InsertPt = VPBasicBlock::iterator();
68  }
69 
70  VPBasicBlock *getInsertBlock() const { return BB; }
71  VPBasicBlock::iterator getInsertPoint() const { return InsertPt; }
72 
73  /// InsertPoint - A saved insertion point.
74  class VPInsertPoint {
75  VPBasicBlock *Block = nullptr;
77 
78  public:
79  /// Creates a new insertion point which doesn't point to anything.
80  VPInsertPoint() = default;
81 
82  /// Creates a new insertion point at the given location.
84  : Block(InsertBlock), Point(InsertPoint) {}
85 
86  /// Returns true if this insert point is set.
87  bool isSet() const { return Block != nullptr; }
88 
89  VPBasicBlock *getBlock() const { return Block; }
90  VPBasicBlock::iterator getPoint() const { return Point; }
91  };
92 
93  /// Sets the current insert point to a previously-saved location.
95  if (IP.isSet())
96  setInsertPoint(IP.getBlock(), IP.getPoint());
97  else
99  }
100 
101  /// This specifies that created VPInstructions should be appended to the end
102  /// of the specified block.
104  assert(TheBB && "Attempting to set a null insert point");
105  BB = TheBB;
106  InsertPt = BB->end();
107  }
108 
109  /// This specifies that created instructions should be inserted at the
110  /// specified point.
112  BB = TheBB;
113  InsertPt = IP;
114  }
115 
116  /// Insert and return the specified instruction.
118  BB->insert(I, InsertPt);
119  return I;
120  }
121 
122  /// Create an N-ary operation with \p Opcode, \p Operands and set \p Inst as
123  /// its underlying Instruction.
125  Instruction *Inst = nullptr) {
126  VPInstruction *NewVPInst = createInstruction(Opcode, Operands);
127  NewVPInst->setUnderlyingValue(Inst);
128  return NewVPInst;
129  }
130  VPValue *createNaryOp(unsigned Opcode,
131  std::initializer_list<VPValue *> Operands,
132  Instruction *Inst = nullptr) {
133  return createNaryOp(Opcode, ArrayRef<VPValue *>(Operands), Inst);
134  }
135 
136  VPValue *createNot(VPValue *Operand) {
137  return createInstruction(VPInstruction::Not, {Operand});
138  }
139 
141  return createInstruction(Instruction::BinaryOps::And, {LHS, RHS});
142  }
143 
145  return createInstruction(Instruction::BinaryOps::Or, {LHS, RHS});
146  }
147 
150  }
151 
152  //===--------------------------------------------------------------------===//
153  // RAII helpers.
154  //===--------------------------------------------------------------------===//
155 
156  /// RAII object that stores the current insertion point and restores it when
157  /// the object is destroyed.
159  VPBuilder &Builder;
160  VPBasicBlock *Block;
162 
163  public:
165  : Builder(B), Block(B.getInsertBlock()), Point(B.getInsertPoint()) {}
166 
167  InsertPointGuard(const InsertPointGuard &) = delete;
168  InsertPointGuard &operator=(const InsertPointGuard &) = delete;
169 
170  ~InsertPointGuard() { Builder.restoreIP(VPInsertPoint(Block, Point)); }
171  };
172 };
173 
174 /// TODO: The following VectorizationFactor was pulled out of
175 /// LoopVectorizationCostModel class. LV also deals with
176 /// VectorizerParams::VectorizationFactor and VectorizationCostTy.
177 /// We need to streamline them.
178 
179 /// Information about vectorization costs.
181  /// Vector width with best cost.
183  /// Cost of the loop with that width.
185 
187  : Width(Width), Cost(Cost) {}
188 
189  /// Width 1 means no vectorization, cost 0 means uncomputed cost.
191  return {ElementCount::getFixed(1), 0};
192  }
193 
194  bool operator==(const VectorizationFactor &rhs) const {
195  return Width == rhs.Width && Cost == rhs.Cost;
196  }
197 
198  bool operator!=(const VectorizationFactor &rhs) const {
199  return !(*this == rhs);
200  }
201 };
202 
203 /// A class that represents two vectorization factors (initialized with 0 by
204 /// default). One for fixed-width vectorization and one for scalable
205 /// vectorization. This can be used by the vectorizer to choose from a range of
206 /// fixed and/or scalable VFs in order to find the most cost-effective VF to
207 /// vectorize with.
211 
213  : FixedVF(ElementCount::getFixed(0)),
214  ScalableVF(ElementCount::getScalable(0)) {}
216  *(Max.isScalable() ? &ScalableVF : &FixedVF) = Max;
217  }
219  const ElementCount &ScalableVF)
222  "Invalid scalable properties");
223  }
224 
226 
227  /// \return true if either fixed- or scalable VF is non-zero.
228  explicit operator bool() const { return FixedVF || ScalableVF; }
229 
230  /// \return true if either fixed- or scalable VF is a valid vector VF.
231  bool hasVector() const { return FixedVF.isVector() || ScalableVF.isVector(); }
232 };
233 
234 /// Planner drives the vectorization process after having passed
235 /// Legality checks.
237  /// The loop that we evaluate.
238  Loop *OrigLoop;
239 
240  /// Loop Info analysis.
241  LoopInfo *LI;
242 
243  /// Target Library Info.
244  const TargetLibraryInfo *TLI;
245 
246  /// Target Transform Info.
247  const TargetTransformInfo *TTI;
248 
249  /// The legality analysis.
251 
252  /// The profitability analysis.
254 
255  /// The interleaved access analysis.
257 
259 
260  const LoopVectorizeHints &Hints;
261 
262  LoopVectorizationRequirements &Requirements;
263 
265 
267 
268  /// A builder used to construct the current plan.
269  VPBuilder Builder;
270 
271  /// The best number of elements of the vector types used in the
272  /// transformed loop. BestVF = None means that vectorization is
273  /// disabled.
274  Optional<ElementCount> BestVF = None;
275  unsigned BestUF = 0;
276 
277 public:
279  const TargetTransformInfo *TTI,
284  const LoopVectorizeHints &Hints,
285  LoopVectorizationRequirements &Requirements,
287  : OrigLoop(L), LI(LI), TLI(TLI), TTI(TTI), Legal(Legal), CM(CM), IAI(IAI),
288  PSE(PSE), Hints(Hints), Requirements(Requirements), ORE(ORE) {}
289 
290  /// Plan how to best vectorize, return the best VF and its cost, or None if
291  /// vectorization and interleaving should be avoided up front.
292  Optional<VectorizationFactor> plan(ElementCount UserVF, unsigned UserIC);
293 
294  /// Use the VPlan-native path to plan how to best vectorize, return the best
295  /// VF and its cost.
297 
298  /// Finalize the best decision and dispose of all other VPlans.
299  void setBestPlan(ElementCount VF, unsigned UF);
300 
301  /// Generate the IR code for the body of the vectorized loop according to the
302  /// best selected VPlan.
304 
305 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
306  void printPlans(raw_ostream &O);
307 #endif
308 
309  /// Look through the existing plans and return true if we have one with all
310  /// the vectorization factors in question.
311  bool hasPlanWithVFs(const ArrayRef<ElementCount> VFs) const {
312  return any_of(VPlans, [&](const VPlanPtr &Plan) {
313  return all_of(VFs, [&](const ElementCount &VF) {
314  return Plan->hasVF(VF);
315  });
316  });
317  }
318 
319  /// Test a \p Predicate on a \p Range of VF's. Return the value of applying
320  /// \p Predicate on Range.Start, possibly decreasing Range.End such that the
321  /// returned value holds for the entire \p Range.
322  static bool
324  VFRange &Range);
325 
326 protected:
327  /// Collect the instructions from the original loop that would be trivially
328  /// dead in the vectorized loop if generated.
330  SmallPtrSetImpl<Instruction *> &DeadInstructions);
331 
332  /// Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive,
333  /// according to the information gathered by Legal when it checked if it is
334  /// legal to vectorize the loop.
335  void buildVPlans(ElementCount MinVF, ElementCount MaxVF);
336 
337 private:
338  /// Build a VPlan according to the information gathered by Legal. \return a
339  /// VPlan for vectorization factors \p Range.Start and up to \p Range.End
340  /// exclusive, possibly decreasing \p Range.End.
341  VPlanPtr buildVPlan(VFRange &Range);
342 
343  /// Build a VPlan using VPRecipes according to the information gather by
344  /// Legal. This method is only used for the legacy inner loop vectorizer.
345  VPlanPtr buildVPlanWithVPRecipes(
346  VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions,
347  const MapVector<Instruction *, Instruction *> &SinkAfter);
348 
349  /// Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive,
350  /// according to the information gathered by Legal when it checked if it is
351  /// legal to vectorize the loop. This method creates VPlans using VPRecipes.
352  void buildVPlansWithVPRecipes(ElementCount MinVF, ElementCount MaxVF);
353 
354  // Adjust the recipes for reductions. For in-loop reductions the chain of
355  // instructions leading from the loop exit instr to the phi need to be
356  // converted to reductions, with one operand being vector and the other being
357  // the scalar reduction chain. For other reductions, a select is introduced
358  // between the phi and live-out recipes when folding the tail.
359  void adjustRecipesForReductions(VPBasicBlock *LatchVPBB, VPlanPtr &Plan,
360  VPRecipeBuilder &RecipeBuilder,
361  ElementCount MinVF);
362 };
363 
364 } // namespace llvm
365 
366 #endif // LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONPLANNER_H
llvm::InstructionCost
Definition: InstructionCost.h:29
llvm::VPBuilder::getInsertBlock
VPBasicBlock * getInsertBlock() const
Definition: LoopVectorizationPlanner.h:70
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::FixedScalableVFPair
A class that represents two vectorization factors (initialized with 0 by default).
Definition: LoopVectorizationPlanner.h:208
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair(const ElementCount &Max)
Definition: LoopVectorizationPlanner.h:215
llvm::VPBuilder::createNaryOp
VPValue * createNaryOp(unsigned Opcode, std::initializer_list< VPValue * > Operands, Instruction *Inst=nullptr)
Definition: LoopVectorizationPlanner.h:130
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:8241
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:124
llvm::VPBuilder::VPInsertPoint::VPInsertPoint
VPInsertPoint()=default
Creates a new insertion point which doesn't point to anything.
llvm::ElementCount
Definition: TypeSize.h:386
llvm::VPBasicBlock
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:1606
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
llvm::FixedScalableVFPair::getNone
static FixedScalableVFPair getNone()
Definition: LoopVectorizationPlanner.h:225
llvm::PredicatedScalarEvolution
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
Definition: ScalarEvolution.h:2098
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:151
llvm::VPBuilder::InsertPointGuard::operator=
InsertPointGuard & operator=(const InsertPointGuard &)=delete
llvm::VPlanPtr
std::unique_ptr< VPlan > VPlanPtr
Definition: VPlan.h:92
llvm::VPBuilder::getInsertPoint
VPBasicBlock::iterator getInsertPoint() const
Definition: LoopVectorizationPlanner.h:71
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:8092
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:61
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair(const ElementCount &FixedVF, const ElementCount &ScalableVF)
Definition: LoopVectorizationPlanner.h:218
llvm::VPRecipeBuilder
Helper class to create VPRecipies from IR instructions.
Definition: VPRecipeBuilder.h:27
llvm::VectorizationFactor::operator==
bool operator==(const VectorizationFactor &rhs) const
Definition: LoopVectorizationPlanner.h:194
llvm::VPBuilder::createNot
VPValue * createNot(VPValue *Operand)
Definition: LoopVectorizationPlanner.h:136
llvm::LinearPolySize::isScalable
bool isScalable() const
Returns whether the size is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:299
llvm::VectorizationFactor::operator!=
bool operator!=(const VectorizationFactor &rhs) const
Definition: LoopVectorizationPlanner.h:198
llvm::VFRange
A range of powers-of-2 vectorization factors with fixed start and adjustable end.
Definition: VPlan.h:72
llvm::LoopVectorizationCostModel
LoopVectorizationCostModel - estimates the expected speedups due to vectorization.
Definition: LoopVectorize.cpp:1225
llvm::VectorizationFactor::VectorizationFactor
VectorizationFactor(ElementCount Width, InstructionCost Cost)
Definition: LoopVectorizationPlanner.h:186
llvm::LoopVectorizationRequirements
This holds vectorization requirements that must be verified late in the process.
Definition: LoopVectorizationLegality.h:213
llvm::VPBasicBlock::iterator
RecipeListTy::iterator iterator
Instruction iterators...
Definition: VPlan.h:1627
llvm::all_of
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1549
llvm::VPInstruction
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:773
llvm::LoopVectorizationPlanner::executePlan
void executePlan(InnerLoopVectorizer &LB, DominatorTree *DT)
Generate the IR code for the body of the vectorized loop according to the best selected VPlan.
Definition: LoopVectorize.cpp:8197
llvm::VPBuilder
VPlan-based builder utility analogous to IRBuilder.
Definition: LoopVectorizationPlanner.h:43
llvm::FixedScalableVFPair::hasVector
bool hasVector() const
Definition: LoopVectorizationPlanner.h:231
llvm::VPBuilder::createOr
VPValue * createOr(VPValue *LHS, VPValue *RHS)
Definition: LoopVectorizationPlanner.h:144
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:8639
IP
Definition: NVPTXLowerArgs.cpp:166
llvm::FixedScalableVFPair::FixedVF
ElementCount FixedVF
Definition: LoopVectorizationPlanner.h:209
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Instruction
Definition: Instruction.h:45
llvm::InterleavedAccessInfo
Drive the analysis of interleaved memory accesses in the loop.
Definition: VectorUtils.h:727
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::VPBuilder::createSelect
VPValue * createSelect(VPValue *Cond, VPValue *TrueVal, VPValue *FalseVal)
Definition: LoopVectorizationPlanner.h:148
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:445
llvm::LoopVectorizationPlanner::setBestPlan
void setBestPlan(ElementCount VF, unsigned UF)
Finalize the best decision and dispose of all other VPlans.
Definition: LoopVectorize.cpp:8185
llvm::None
const NoneType None
Definition: None.h:23
llvm::LinearPolySize< ElementCount >::getFixed
static ElementCount getFixed(ScalarTy MinVal)
Definition: TypeSize.h:284
llvm::LoopVectorizationPlanner
Planner drives the vectorization process after having passed Legality checks.
Definition: LoopVectorizationPlanner.h:236
llvm::VectorizationFactor::Cost
InstructionCost Cost
Cost of the loop with that width.
Definition: LoopVectorizationPlanner.h:184
llvm::VPBuilder::insert
VPInstruction * insert(VPInstruction *I) const
Insert and return the specified instruction.
Definition: LoopVectorizationPlanner.h:117
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:78
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:192
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:46
llvm::IRSimilarity::Legal
@ Legal
Definition: IRSimilarityIdentifier.h:75
llvm::VPBuilder::VPInsertPoint::getBlock
VPBasicBlock * getBlock() const
Definition: LoopVectorizationPlanner.h:89
llvm::VPBuilder::InsertPointGuard::~InsertPointGuard
~InsertPointGuard()
Definition: LoopVectorizationPlanner.h:170
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:278
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::VPBuilder::VPBuilder
VPBuilder()
Definition: LoopVectorizationPlanner.h:61
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:158
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::ElementCount::isVector
bool isVector() const
One or more elements.
Definition: TypeSize.h:398
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:650
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:111
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:1083
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:1556
Cond
SmallVector< MachineOperand, 4 > Cond
Definition: BasicBlockSections.cpp:179
llvm::VPBuilder::createAnd
VPValue * createAnd(VPValue *LHS, VPValue *RHS)
Definition: LoopVectorizationPlanner.h:140
llvm::LoopVectorizationPlanner::hasPlanWithVFs
bool hasPlanWithVFs(const ArrayRef< ElementCount > VFs) const
Look through the existing plans and return true if we have one with all the vectorization factors in ...
Definition: LoopVectorizationPlanner.h:311
llvm::VPValue::setUnderlyingValue
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:77
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:162
llvm::LoopVectorizationPlanner::printPlans
void printPlans(raw_ostream &O)
Definition: LoopVectorize.cpp:8232
llvm::VPBuilder::clearInsertionPoint
void clearInsertionPoint()
Clear the insertion point: created instructions will not be inserted into a block.
Definition: LoopVectorizationPlanner.h:65
llvm::VectorizationFactor
TODO: The following VectorizationFactor was pulled out of LoopVectorizationCostModel class.
Definition: LoopVectorizationPlanner.h:180
llvm::FixedScalableVFPair::ScalableVF
ElementCount ScalableVF
Definition: LoopVectorizationPlanner.h:210
llvm::VPBuilder::VPInsertPoint
InsertPoint - A saved insertion point.
Definition: LoopVectorizationPlanner.h:74
llvm::VPBuilder::restoreIP
void restoreIP(VPInsertPoint IP)
Sets the current insert point to a previously-saved location.
Definition: LoopVectorizationPlanner.h:94
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition: TargetLibraryInfo.h:219
llvm::VPBuilder::VPInsertPoint::VPInsertPoint
VPInsertPoint(VPBasicBlock *InsertBlock, VPBasicBlock::iterator InsertPoint)
Creates a new insertion point at the given location.
Definition: LoopVectorizationPlanner.h:83
llvm::VPBuilder::InsertPointGuard::InsertPointGuard
InsertPointGuard(VPBuilder &B)
Definition: LoopVectorizationPlanner.h:164
llvm::VectorizationFactor::Width
ElementCount Width
Vector width with best cost.
Definition: LoopVectorizationPlanner.h:182
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:8047
llvm::VPInstruction::Not
@ Not
Definition: VPlan.h:782
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:103
llvm::FixedScalableVFPair::FixedScalableVFPair
FixedScalableVFPair()
Definition: LoopVectorizationPlanner.h:212
llvm::VPBuilder::VPInsertPoint::getPoint
VPBasicBlock::iterator getPoint() const
Definition: LoopVectorizationPlanner.h:90
llvm::SmallPtrSetImpl< Instruction * >
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::tgtok::TrueVal
@ TrueVal
Definition: TGLexer.h:61
llvm::VPBuilder::VPInsertPoint::isSet
bool isSet() const
Returns true if this insert point is set.
Definition: LoopVectorizationPlanner.h:87
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:8619
llvm::VectorizationFactor::Disabled
static VectorizationFactor Disabled()
Width 1 means no vectorization, cost 0 means uncomputed cost.
Definition: LoopVectorizationPlanner.h:190