LLVM 20.0.0git
VPlanValue.h
Go to the documentation of this file.
1//===- VPlanValue.h - Represent Values in Vectorizer Plan -----------------===//
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 contains the declarations of the entities induced by Vectorization
11/// Plans, e.g. the instructions the VPlan intends to generate if executed.
12/// VPlan models the following entities:
13/// VPValue VPUser VPDef
14/// | |
15/// VPInstruction
16/// These are documented in docs/VectorizationPlan.rst.
17///
18//===----------------------------------------------------------------------===//
19
20#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
21#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
22
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/ADT/STLExtras.h"
26#include "llvm/ADT/StringMap.h"
29
30namespace llvm {
31
32// Forward declarations.
33class raw_ostream;
34class Value;
35class VPDef;
36struct VPDoubleValueDef;
37class VPSlotTracker;
38class VPUser;
39class VPRecipeBase;
40class VPInterleaveRecipe;
41
42// This is the base class of the VPlan Def/Use graph, used for modeling the data
43// flow into, within and out of the VPlan. VPValues can stand for live-ins
44// coming from the input IR and instructions which VPlan will generate if
45// executed.
46class VPValue {
47 friend class VPBuilder;
48 friend class VPDef;
49 friend struct VPDoubleValueDef;
50 friend class VPInstruction;
51 friend class VPInterleaveRecipe;
52 friend struct VPlanTransforms;
53 friend class VPBasicBlock;
55 friend class VPSlotTracker;
56 friend class VPRecipeBase;
57 friend class VPlan;
58
59 const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
60
62
63protected:
64 // Hold the underlying Value, if any, attached to this VPValue.
66
67 /// Pointer to the VPDef that defines this VPValue. If it is nullptr, the
68 /// VPValue is not defined by any recipe modeled in VPlan.
70
71 VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
72
73 /// Create a live-in VPValue.
74 VPValue(Value *UV = nullptr) : VPValue(VPValueSC, UV, nullptr) {}
75 /// Create a VPValue for a \p Def which is a subclass of VPValue.
76 VPValue(VPDef *Def, Value *UV = nullptr) : VPValue(VPVRecipeSC, UV, Def) {}
77 /// Create a VPValue for a \p Def which defines multiple values.
79
80 // DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
81 // the front-end and back-end of VPlan so that the middle-end is as
82 // independent as possible of the underlying IR. We grant access to the
83 // underlying IR using friendship. In that way, we should be able to use VPlan
84 // for multiple underlying IRs (Polly?) by providing a new VPlan front-end,
85 // back-end and analysis information for the new IR.
86
87public:
88 /// Return the underlying Value attached to this VPValue.
90
91 /// An enumeration for keeping track of the concrete subclass of VPValue that
92 /// are actually instantiated.
93 enum {
94 VPValueSC, /// A generic VPValue, like live-in values or defined by a recipe
95 /// that defines multiple values.
96 VPVRecipeSC /// A VPValue sub-class that is a VPRecipeBase.
97 };
98
99 VPValue(const VPValue &) = delete;
100 VPValue &operator=(const VPValue &) = delete;
101
102 virtual ~VPValue();
103
104 /// \return an ID for the concrete type of this object.
105 /// This is used to implement the classof checks. This should not be used
106 /// for any other purpose, as the values may change as LLVM evolves.
107 unsigned getVPValueID() const { return SubclassID; }
108
109#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
110 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
111 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
112
113 /// Dump the value to stderr (for debugging).
114 void dump() const;
115#endif
116
117 unsigned getNumUsers() const { return Users.size(); }
118 void addUser(VPUser &User) { Users.push_back(&User); }
119
120 /// Remove a single \p User from the list of users.
122 // The same user can be added multiple times, e.g. because the same VPValue
123 // is used twice by the same VPUser. Remove a single one.
124 auto *I = find(Users, &User);
125 if (I != Users.end())
126 Users.erase(I);
127 }
128
133
134 user_iterator user_begin() { return Users.begin(); }
135 const_user_iterator user_begin() const { return Users.begin(); }
136 user_iterator user_end() { return Users.end(); }
137 const_user_iterator user_end() const { return Users.end(); }
141 }
142
143 /// Returns true if the value has more than one unique user.
145 if (getNumUsers() == 0)
146 return false;
147
148 // Check if all users match the first user.
149 auto Current = std::next(user_begin());
150 while (Current != user_end() && *user_begin() == *Current)
151 Current++;
152 return Current != user_end();
153 }
154
155 void replaceAllUsesWith(VPValue *New);
156
157 /// Go through the uses list for this VPValue and make each use point to \p
158 /// New if the callback ShouldReplace returns true for the given use specified
159 /// by a pair of (VPUser, the use index).
161 VPValue *New,
162 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
163
164 /// Returns the recipe defining this VPValue or nullptr if it is not defined
165 /// by a recipe, i.e. is a live-in.
167 const VPRecipeBase *getDefiningRecipe() const;
168
169 /// Returns true if this VPValue is defined by a recipe.
170 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
171
172 /// Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
173 bool isLiveIn() const { return !hasDefiningRecipe(); }
174
175 /// Returns the underlying IR value, if this VPValue is defined outside the
176 /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
177 /// inside a VPlan.
179 assert(isLiveIn() &&
180 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
181 return getUnderlyingValue();
182 }
183 const Value *getLiveInIRValue() const {
184 assert(isLiveIn() &&
185 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
186 return getUnderlyingValue();
187 }
188
189 /// Returns true if the VPValue is defined outside any loop region.
190 bool isDefinedOutsideLoopRegions() const;
191
192 // Set \p Val as the underlying Value of this VPValue.
194 assert(!UnderlyingVal && "Underlying Value is already set.");
195 UnderlyingVal = Val;
196 }
197};
198
201
203
204/// This class augments VPValue with operands which provide the inverse def-use
205/// edges from VPValue's users to their defs.
206class VPUser {
208
209protected:
210#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
211 /// Print the operands to \p O.
213#endif
214
216 for (VPValue *Operand : Operands)
217 addOperand(Operand);
218 }
219
220 VPUser(std::initializer_list<VPValue *> Operands)
222
223 template <typename IterT> VPUser(iterator_range<IterT> Operands) {
224 for (VPValue *Operand : Operands)
225 addOperand(Operand);
226 }
227
228public:
229 VPUser() = delete;
230 VPUser(const VPUser &) = delete;
231 VPUser &operator=(const VPUser &) = delete;
232 virtual ~VPUser() {
233 for (VPValue *Op : operands())
234 Op->removeUser(*this);
235 }
236
237 void addOperand(VPValue *Operand) {
238 Operands.push_back(Operand);
239 Operand->addUser(*this);
240 }
241
242 unsigned getNumOperands() const { return Operands.size(); }
243 inline VPValue *getOperand(unsigned N) const {
244 assert(N < Operands.size() && "Operand index out of bounds");
245 return Operands[N];
246 }
247
248 void setOperand(unsigned I, VPValue *New) {
249 Operands[I]->removeUser(*this);
250 Operands[I] = New;
251 New->addUser(*this);
252 }
253
258
259 operand_iterator op_begin() { return Operands.begin(); }
260 const_operand_iterator op_begin() const { return Operands.begin(); }
261 operand_iterator op_end() { return Operands.end(); }
262 const_operand_iterator op_end() const { return Operands.end(); }
266 }
267
268 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
269 /// returns if only first (scalar) lane is used, as default.
270 virtual bool usesScalars(const VPValue *Op) const {
272 "Op must be an operand of the recipe");
273 return onlyFirstLaneUsed(Op);
274 }
275
276 /// Returns true if the VPUser only uses the first lane of operand \p Op.
277 /// Conservatively returns false.
278 virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
280 "Op must be an operand of the recipe");
281 return false;
282 }
283
284 /// Returns true if the VPUser only uses the first part of operand \p Op.
285 /// Conservatively returns false.
286 virtual bool onlyFirstPartUsed(const VPValue *Op) const {
288 "Op must be an operand of the recipe");
289 return false;
290 }
291};
292
293/// This class augments a recipe with a set of VPValues defined by the recipe.
294/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
295/// the VPValues it defines and is responsible for deleting its defined values.
296/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
297/// from VPDef before VPValue.
298class VPDef {
299 friend class VPValue;
300
301 /// Subclass identifier (for isa/dyn_cast).
302 const unsigned char SubclassID;
303
304 /// The VPValues defined by this VPDef.
305 TinyPtrVector<VPValue *> DefinedValues;
306
307 /// Add \p V as a defined value by this VPDef.
308 void addDefinedValue(VPValue *V) {
309 assert(V->Def == this &&
310 "can only add VPValue already linked with this VPDef");
311 DefinedValues.push_back(V);
312 }
313
314 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
315 /// value of this VPDef.
316 void removeDefinedValue(VPValue *V) {
317 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
318 assert(is_contained(DefinedValues, V) &&
319 "VPValue to remove must be in DefinedValues");
320 llvm::erase(DefinedValues, V);
321 V->Def = nullptr;
322 }
323
324public:
325 /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
326 /// that is actually instantiated. Values of this enumeration are kept in the
327 /// SubclassID field of the VPRecipeBase objects. They are used for concrete
328 /// type identification.
329 using VPRecipeTy = enum {
330 VPBranchOnMaskSC,
331 VPDerivedIVSC,
332 VPExpandSCEVSC,
333 VPIRInstructionSC,
334 VPInstructionSC,
335 VPInterleaveSC,
336 VPReductionEVLSC,
337 VPReductionSC,
338 VPPartialReductionSC,
339 VPReplicateSC,
340 VPScalarCastSC,
341 VPScalarIVStepsSC,
342 VPVectorPointerSC,
343 VPReverseVectorPointerSC,
344 VPWidenCallSC,
345 VPWidenCanonicalIVSC,
346 VPWidenCastSC,
347 VPWidenGEPSC,
348 VPWidenIntrinsicSC,
349 VPWidenLoadEVLSC,
350 VPWidenLoadSC,
351 VPWidenStoreEVLSC,
352 VPWidenStoreSC,
353 VPWidenSC,
354 VPWidenEVLSC,
355 VPWidenSelectSC,
356 VPBlendSC,
357 VPHistogramSC,
358 // START: Phi-like recipes. Need to be kept together.
359 VPWidenPHISC,
360 VPPredInstPHISC,
361 // START: SubclassID for recipes that inherit VPHeaderPHIRecipe.
362 // VPHeaderPHIRecipe need to be kept together.
363 VPCanonicalIVPHISC,
364 VPActiveLaneMaskPHISC,
365 VPEVLBasedIVPHISC,
366 VPFirstOrderRecurrencePHISC,
367 VPWidenIntOrFpInductionSC,
368 VPWidenPointerInductionSC,
369 VPScalarPHISC,
370 VPReductionPHISC,
371 // END: SubclassID for recipes that inherit VPHeaderPHIRecipe
372 // END: Phi-like recipes
373 VPFirstPHISC = VPWidenPHISC,
374 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
375 VPLastHeaderPHISC = VPReductionPHISC,
376 VPLastPHISC = VPReductionPHISC,
377 };
378
379 VPDef(const unsigned char SC) : SubclassID(SC) {}
380
381 virtual ~VPDef() {
382 for (VPValue *D : make_early_inc_range(DefinedValues)) {
383 assert(D->Def == this &&
384 "all defined VPValues should point to the containing VPDef");
385 assert(D->getNumUsers() == 0 &&
386 "all defined VPValues should have no more users");
387 D->Def = nullptr;
388 delete D;
389 }
390 }
391
392 /// Returns the only VPValue defined by the VPDef. Can only be called for
393 /// VPDefs with a single defined value.
395 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
396 assert(DefinedValues[0] && "defined value must be non-null");
397 return DefinedValues[0];
398 }
399 const VPValue *getVPSingleValue() const {
400 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
401 assert(DefinedValues[0] && "defined value must be non-null");
402 return DefinedValues[0];
403 }
404
405 /// Returns the VPValue with index \p I defined by the VPDef.
406 VPValue *getVPValue(unsigned I) {
407 assert(DefinedValues[I] && "defined value must be non-null");
408 return DefinedValues[I];
409 }
410 const VPValue *getVPValue(unsigned I) const {
411 assert(DefinedValues[I] && "defined value must be non-null");
412 return DefinedValues[I];
413 }
414
415 /// Returns an ArrayRef of the values defined by the VPDef.
416 ArrayRef<VPValue *> definedValues() { return DefinedValues; }
417 /// Returns an ArrayRef of the values defined by the VPDef.
418 ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
419
420 /// Returns the number of values defined by the VPDef.
421 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
422
423 /// \return an ID for the concrete type of this object.
424 /// This is used to implement the classof checks. This should not be used
425 /// for any other purpose, as the values may change as LLVM evolves.
426 unsigned getVPDefID() const { return SubclassID; }
427
428#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
429 /// Dump the VPDef to stderr (for debugging).
430 void dump() const;
431
432 /// Each concrete VPDef prints itself.
433 virtual void print(raw_ostream &O, const Twine &Indent,
434 VPSlotTracker &SlotTracker) const = 0;
435#endif
436};
437
438class VPlan;
439class VPBasicBlock;
440
441/// This class can be used to assign names to VPValues. For VPValues without
442/// underlying value, assign consecutive numbers and use those as names (wrapped
443/// in vp<>). Otherwise, use the name from the underlying value (wrapped in
444/// ir<>), appending a .V version number if there are multiple uses of the same
445/// name. Allows querying names for VPValues for printing, similar to the
446/// ModuleSlotTracker for IR values.
448 /// Keep track of versioned names assigned to VPValues with underlying IR
449 /// values.
451 /// Keep track of the next number to use to version the base name.
452 StringMap<unsigned> BaseName2Version;
453
454 /// Number to assign to the next VPValue without underlying value.
455 unsigned NextSlot = 0;
456
457 void assignName(const VPValue *V);
458 void assignNames(const VPlan &Plan);
459 void assignNames(const VPBasicBlock *VPBB);
460
461public:
462 VPSlotTracker(const VPlan *Plan = nullptr) {
463 if (Plan)
464 assignNames(*Plan);
465 }
466
467 /// Returns the name assigned to \p V, if there is one, otherwise try to
468 /// construct one from the underlying value, if there's one; else return
469 /// <badref>.
470 std::string getOrCreateName(const VPValue *V) const;
471};
472
473} // namespace llvm
474
475#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VALUE_H
This file defines the StringMap class.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
iv Induction Variable Users
Definition: IVUsers.cpp:48
#define I(x, y, z)
Definition: MD5.cpp:58
mir Rename Register Operands
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
raw_pwrite_stream & OS
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class represents an Operation in the Expression.
This class provides computation of slot numbers for LLVM Assembly writing.
Definition: AsmWriter.cpp:698
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:578
typename SuperClass::iterator iterator
Definition: SmallVector.h:577
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:29
void push_back(EltTy NewVal)
unsigned size() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:3536
VPlan-based builder utility analogous to IRBuilder.
This class augments a recipe with a set of VPValues defined by the recipe.
Definition: VPlanValue.h:298
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPIRInstructionSC, VPInstructionSC, VPInterleaveSC, VPReductionEVLSC, VPReductionSC, VPPartialReductionSC, VPReplicateSC, VPScalarCastSC, VPScalarIVStepsSC, VPVectorPointerSC, VPReverseVectorPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenIntrinsicSC, VPWidenLoadEVLSC, VPWidenLoadSC, VPWidenStoreEVLSC, VPWidenStoreSC, VPWidenSC, VPWidenEVLSC, VPWidenSelectSC, VPBlendSC, VPHistogramSC, VPWidenPHISC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPEVLBasedIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, VPScalarPHISC, VPReductionPHISC, VPFirstPHISC=VPWidenPHISC, VPFirstHeaderPHISC=VPCanonicalIVPHISC, VPLastHeaderPHISC=VPReductionPHISC, VPLastPHISC=VPReductionPHISC, } VPRecipeTy
An enumeration for keeping track of the concrete subclass of VPRecipeBase that is actually instantiat...
Definition: VPlanValue.h:377
void dump() const
Dump the VPDef to stderr (for debugging).
Definition: VPlan.cpp:114
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition: VPlanValue.h:421
virtual ~VPDef()
Definition: VPlanValue.h:381
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:416
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition: VPlanValue.h:394
const VPValue * getVPSingleValue() const
Definition: VPlanValue.h:399
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:418
virtual void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const =0
Each concrete VPDef prints itself.
VPValue * getVPValue(unsigned I)
Returns the VPValue with index I defined by the VPDef.
Definition: VPlanValue.h:406
unsigned getVPDefID() const
Definition: VPlanValue.h:426
VPDef(const unsigned char SC)
Definition: VPlanValue.h:379
const VPValue * getVPValue(unsigned I) const
Definition: VPlanValue.h:410
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:1194
VPInterleaveRecipe is a recipe for transforming an interleave group of load or stores into one wide l...
Definition: VPlan.h:2561
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition: VPlan.h:716
This class can be used to assign names to VPValues.
Definition: VPlanValue.h:447
std::string getOrCreateName(const VPValue *V) const
Returns the name assigned to V, if there is one, otherwise try to construct one from the underlying v...
Definition: VPlan.cpp:1578
VPSlotTracker(const VPlan *Plan=nullptr)
Definition: VPlanValue.h:462
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition: VPlanValue.h:206
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition: VPlan.cpp:1456
VPUser(std::initializer_list< VPValue * > Operands)
Definition: VPlanValue.h:220
operand_range operands()
Definition: VPlanValue.h:263
void setOperand(unsigned I, VPValue *New)
Definition: VPlanValue.h:248
VPUser & operator=(const VPUser &)=delete
unsigned getNumOperands() const
Definition: VPlanValue.h:242
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition: VPlanValue.h:255
const_operand_iterator op_begin() const
Definition: VPlanValue.h:260
operand_iterator op_end()
Definition: VPlanValue.h:261
const_operand_range operands() const
Definition: VPlanValue.h:264
operand_iterator op_begin()
Definition: VPlanValue.h:259
VPValue * getOperand(unsigned N) const
Definition: VPlanValue.h:243
VPUser(ArrayRef< VPValue * > Operands)
Definition: VPlanValue.h:215
VPUser(const VPUser &)=delete
VPUser()=delete
virtual bool onlyFirstLaneUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first lane of operand Op.
Definition: VPlanValue.h:278
VPUser(iterator_range< IterT > Operands)
Definition: VPlanValue.h:223
iterator_range< const_operand_iterator > const_operand_range
Definition: VPlanValue.h:257
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition: VPlanValue.h:254
virtual ~VPUser()
Definition: VPlanValue.h:232
virtual bool onlyFirstPartUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition: VPlanValue.h:286
const_operand_iterator op_end() const
Definition: VPlanValue.h:262
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition: VPlanValue.h:270
iterator_range< operand_iterator > operand_range
Definition: VPlanValue.h:256
void addOperand(VPValue *Operand)
Definition: VPlanValue.h:237
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition: VPlanValue.h:170
VPValue(Value *UV=nullptr)
Create a live-in VPValue.
Definition: VPlanValue.h:74
bool isDefinedOutsideLoopRegions() const
Returns true if the VPValue is defined outside any loop region.
Definition: VPlan.cpp:1417
unsigned getVPValueID() const
Definition: VPlanValue.h:107
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition: VPlan.cpp:123
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:1452
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition: VPlanValue.h:121
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition: VPlanValue.h:130
const_user_iterator user_begin() const
Definition: VPlanValue.h:135
const Value * getLiveInIRValue() const
Definition: VPlanValue.h:183
void addUser(VPUser &User)
Definition: VPlanValue.h:118
bool hasMoreThanOneUniqueUser() const
Returns true if the value has more than one unique user.
Definition: VPlanValue.h:144
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
Definition: VPlanValue.h:89
Value * UnderlyingVal
Definition: VPlanValue.h:65
VPValue(Value *UV, VPDef *Def)
Create a VPValue for a Def which defines multiple values.
Definition: VPlanValue.h:78
const_user_range users() const
Definition: VPlanValue.h:139
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
void dump() const
Dump the value to stderr (for debugging).
Definition: VPlan.cpp:106
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:193
virtual ~VPValue()
Definition: VPlan.cpp:92
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition: VPlanValue.h:129
iterator_range< user_iterator > user_range
Definition: VPlanValue.h:131
const_user_iterator user_end() const
Definition: VPlanValue.h:137
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:99
void replaceAllUsesWith(VPValue *New)
Definition: VPlan.cpp:1420
VPValue(VPDef *Def, Value *UV=nullptr)
Create a VPValue for a Def which is a subclass of VPValue.
Definition: VPlanValue.h:76
user_iterator user_begin()
Definition: VPlanValue.h:134
unsigned getNumUsers() const
Definition: VPlanValue.h:117
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
Definition: VPlanValue.h:178
user_iterator user_end()
Definition: VPlanValue.h:136
bool isLiveIn() const
Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
Definition: VPlanValue.h:173
friend struct VPDoubleValueDef
Definition: VPlanValue.h:49
void replaceUsesWithIf(VPValue *New, llvm::function_ref< bool(VPUser &U, unsigned Idx)> ShouldReplace)
Go through the uses list for this VPValue and make each use point to New if the callback ShouldReplac...
Definition: VPlan.cpp:1424
user_range users()
Definition: VPlanValue.h:138
VPDef * Def
Pointer to the VPDef that defines this VPValue.
Definition: VPlanValue.h:69
@ VPVRecipeSC
A generic VPValue, like live-in values or defined by a recipe that defines multiple values.
Definition: VPlanValue.h:96
iterator_range< const_user_iterator > const_user_range
Definition: VPlanValue.h:132
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:3812
LLVM Value Representation.
Definition: Value.h:74
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1759
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition: STLExtras.h:657
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition: STLExtras.h:2107
DenseMap< VPValue *, Value * > VPValue2ValueTy
Definition: VPlanValue.h:200
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:303
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1903
DenseMap< Value *, VPValue * > Value2VPValueTy
Definition: VPlanValue.h:199
#define N