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