LLVM 19.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;
36class VPSlotTracker;
37class VPUser;
38class VPRecipeBase;
39
40// This is the base class of the VPlan Def/Use graph, used for modeling the data
41// flow into, within and out of the VPlan. VPValues can stand for live-ins
42// coming from the input IR, instructions which VPlan will generate if executed
43// and live-outs which the VPlan will need to fix accordingly.
44class VPValue {
45 friend class VPBuilder;
46 friend class VPDef;
47 friend class VPInstruction;
48 friend struct VPlanTransforms;
49 friend class VPBasicBlock;
51 friend class VPSlotTracker;
52 friend class VPRecipeBase;
53
54 const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
55
57
58protected:
59 // Hold the underlying Value, if any, attached to this VPValue.
61
62 /// Pointer to the VPDef that defines this VPValue. If it is nullptr, the
63 /// VPValue is not defined by any recipe modeled in VPlan.
65
66 VPValue(const unsigned char SC, Value *UV = nullptr, VPDef *Def = nullptr);
67
68 // DESIGN PRINCIPLE: Access to the underlying IR must be strictly limited to
69 // the front-end and back-end of VPlan so that the middle-end is as
70 // independent as possible of the underlying IR. We grant access to the
71 // underlying IR using friendship. In that way, we should be able to use VPlan
72 // for multiple underlying IRs (Polly?) by providing a new VPlan front-end,
73 // back-end and analysis information for the new IR.
74
75public:
76 /// Return the underlying Value attached to this VPValue.
78 const Value *getUnderlyingValue() const { return UnderlyingVal; }
79
80 /// An enumeration for keeping track of the concrete subclass of VPValue that
81 /// are actually instantiated.
82 enum {
83 VPValueSC, /// A generic VPValue, like live-in values or defined by a recipe
84 /// that defines multiple values.
85 VPVRecipeSC /// A VPValue sub-class that is a VPRecipeBase.
86 };
87
88 /// Create a live-in VPValue.
89 VPValue(Value *UV = nullptr) : VPValue(VPValueSC, UV, nullptr) {}
90 /// Create a VPValue for a \p Def which is a subclass of VPValue.
91 VPValue(VPDef *Def, Value *UV = nullptr) : VPValue(VPVRecipeSC, UV, Def) {}
92 /// Create a VPValue for a \p Def which defines multiple values.
94 VPValue(const VPValue &) = delete;
95 VPValue &operator=(const VPValue &) = delete;
96
97 virtual ~VPValue();
98
99 /// \return an ID for the concrete type of this object.
100 /// This is used to implement the classof checks. This should not be used
101 /// for any other purpose, as the values may change as LLVM evolves.
102 unsigned getVPValueID() const { return SubclassID; }
103
104#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
105 void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const;
106 void print(raw_ostream &OS, VPSlotTracker &Tracker) const;
107
108 /// Dump the value to stderr (for debugging).
109 void dump() const;
110#endif
111
112 unsigned getNumUsers() const { return Users.size(); }
113 void addUser(VPUser &User) { Users.push_back(&User); }
114
115 /// Remove a single \p User from the list of users.
117 // The same user can be added multiple times, e.g. because the same VPValue
118 // is used twice by the same VPUser. Remove a single one.
119 auto *I = find(Users, &User);
120 if (I != Users.end())
121 Users.erase(I);
122 }
123
128
129 user_iterator user_begin() { return Users.begin(); }
130 const_user_iterator user_begin() const { return Users.begin(); }
131 user_iterator user_end() { return Users.end(); }
132 const_user_iterator user_end() const { return Users.end(); }
136 }
137
138 /// Returns true if the value has more than one unique user.
140 if (getNumUsers() == 0)
141 return false;
142
143 // Check if all users match the first user.
144 auto Current = std::next(user_begin());
145 while (Current != user_end() && *user_begin() == *Current)
146 Current++;
147 return Current != user_end();
148 }
149
150 void replaceAllUsesWith(VPValue *New);
151
152 /// Go through the uses list for this VPValue and make each use point to \p
153 /// New if the callback ShouldReplace returns true for the given use specified
154 /// by a pair of (VPUser, the use index).
156 VPValue *New,
157 llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
158
159 /// Returns the recipe defining this VPValue or nullptr if it is not defined
160 /// by a recipe, i.e. is a live-in.
162 const VPRecipeBase *getDefiningRecipe() const;
163
164 /// Returns true if this VPValue is defined by a recipe.
165 bool hasDefiningRecipe() const { return getDefiningRecipe(); }
166
167 /// Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
168 bool isLiveIn() const { return !hasDefiningRecipe(); }
169
170 /// Returns the underlying IR value, if this VPValue is defined outside the
171 /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
172 /// inside a VPlan.
174 assert(isLiveIn() &&
175 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
176 return getUnderlyingValue();
177 }
178 const Value *getLiveInIRValue() const {
179 assert(isLiveIn() &&
180 "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
181 return getUnderlyingValue();
182 }
183
184 /// Returns true if the VPValue is defined outside any vector regions, i.e. it
185 /// is a live-in value.
186 /// TODO: Also handle recipes defined in pre-header blocks.
188
189 // Set \p Val as the underlying Value of this VPValue.
191 assert(!UnderlyingVal && "Underlying Value is already set.");
192 UnderlyingVal = Val;
193 }
194};
195
198
200
201/// This class augments VPValue with operands which provide the inverse def-use
202/// edges from VPValue's users to their defs.
203class VPUser {
204public:
205 /// Subclass identifier (for isa/dyn_cast).
206 enum class VPUserID {
207 Recipe,
208 LiveOut,
209 };
210
211private:
213
214 VPUserID ID;
215
216protected:
217#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
218 /// Print the operands to \p O.
220#endif
221
223 for (VPValue *Operand : Operands)
224 addOperand(Operand);
225 }
226
227 VPUser(std::initializer_list<VPValue *> Operands, VPUserID ID)
229
230 template <typename IterT>
232 for (VPValue *Operand : Operands)
233 addOperand(Operand);
234 }
235
236public:
237 VPUser() = delete;
238 VPUser(const VPUser &) = delete;
239 VPUser &operator=(const VPUser &) = delete;
240 virtual ~VPUser() {
241 for (VPValue *Op : operands())
242 Op->removeUser(*this);
243 }
244
245 VPUserID getVPUserID() const { return ID; }
246
247 void addOperand(VPValue *Operand) {
248 Operands.push_back(Operand);
249 Operand->addUser(*this);
250 }
251
252 unsigned getNumOperands() const { return Operands.size(); }
253 inline VPValue *getOperand(unsigned N) const {
254 assert(N < Operands.size() && "Operand index out of bounds");
255 return Operands[N];
256 }
257
258 void setOperand(unsigned I, VPValue *New) {
259 Operands[I]->removeUser(*this);
260 Operands[I] = New;
261 New->addUser(*this);
262 }
263
268
269 operand_iterator op_begin() { return Operands.begin(); }
270 const_operand_iterator op_begin() const { return Operands.begin(); }
271 operand_iterator op_end() { return Operands.end(); }
272 const_operand_iterator op_end() const { return Operands.end(); }
276 }
277
278 /// Returns true if the VPUser uses scalars of operand \p Op. Conservatively
279 /// returns if only first (scalar) lane is used, as default.
280 virtual bool usesScalars(const VPValue *Op) const {
282 "Op must be an operand of the recipe");
283 return onlyFirstLaneUsed(Op);
284 }
285
286 /// Returns true if the VPUser only uses the first lane of operand \p Op.
287 /// Conservatively returns false.
288 virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
290 "Op must be an operand of the recipe");
291 return false;
292 }
293
294 /// Returns true if the VPUser only uses the first part of operand \p Op.
295 /// Conservatively returns false.
296 virtual bool onlyFirstPartUsed(const VPValue *Op) const {
298 "Op must be an operand of the recipe");
299 return false;
300 }
301};
302
303/// This class augments a recipe with a set of VPValues defined by the recipe.
304/// It allows recipes to define zero, one or multiple VPValues. A VPDef owns
305/// the VPValues it defines and is responsible for deleting its defined values.
306/// Single-value VPDefs that also inherit from VPValue must make sure to inherit
307/// from VPDef before VPValue.
308class VPDef {
309 friend class VPValue;
310
311 /// Subclass identifier (for isa/dyn_cast).
312 const unsigned char SubclassID;
313
314 /// The VPValues defined by this VPDef.
315 TinyPtrVector<VPValue *> DefinedValues;
316
317 /// Add \p V as a defined value by this VPDef.
318 void addDefinedValue(VPValue *V) {
319 assert(V->Def == this &&
320 "can only add VPValue already linked with this VPDef");
321 DefinedValues.push_back(V);
322 }
323
324 /// Remove \p V from the values defined by this VPDef. \p V must be a defined
325 /// value of this VPDef.
326 void removeDefinedValue(VPValue *V) {
327 assert(V->Def == this && "can only remove VPValue linked with this VPDef");
328 assert(is_contained(DefinedValues, V) &&
329 "VPValue to remove must be in DefinedValues");
330 llvm::erase(DefinedValues, V);
331 V->Def = nullptr;
332 }
333
334public:
335 /// An enumeration for keeping track of the concrete subclass of VPRecipeBase
336 /// that is actually instantiated. Values of this enumeration are kept in the
337 /// SubclassID field of the VPRecipeBase objects. They are used for concrete
338 /// type identification.
339 using VPRecipeTy = enum {
340 VPBranchOnMaskSC,
341 VPDerivedIVSC,
342 VPExpandSCEVSC,
343 VPInstructionSC,
344 VPInterleaveSC,
345 VPReductionSC,
346 VPReplicateSC,
347 VPScalarCastSC,
348 VPScalarIVStepsSC,
349 VPVectorPointerSC,
350 VPWidenCallSC,
351 VPWidenCanonicalIVSC,
352 VPWidenCastSC,
353 VPWidenGEPSC,
354 VPWidenLoadEVLSC,
355 VPWidenLoadSC,
356 VPWidenStoreEVLSC,
357 VPWidenStoreSC,
358 VPWidenSC,
359 VPWidenSelectSC,
360 VPBlendSC,
361 // START: Phi-like recipes. Need to be kept together.
362 VPWidenPHISC,
363 VPPredInstPHISC,
364 // START: SubclassID for recipes that inherit VPHeaderPHIRecipe.
365 // VPHeaderPHIRecipe need to be kept together.
366 VPCanonicalIVPHISC,
367 VPActiveLaneMaskPHISC,
368 VPEVLBasedIVPHISC,
369 VPFirstOrderRecurrencePHISC,
370 VPWidenIntOrFpInductionSC,
371 VPWidenPointerInductionSC,
372 VPReductionPHISC,
373 // END: SubclassID for recipes that inherit VPHeaderPHIRecipe
374 // END: Phi-like recipes
375 VPFirstPHISC = VPWidenPHISC,
376 VPFirstHeaderPHISC = VPCanonicalIVPHISC,
377 VPLastHeaderPHISC = VPReductionPHISC,
378 VPLastPHISC = VPReductionPHISC,
379 };
380
381 VPDef(const unsigned char SC) : SubclassID(SC) {}
382
383 virtual ~VPDef() {
384 for (VPValue *D : make_early_inc_range(DefinedValues)) {
385 assert(D->Def == this &&
386 "all defined VPValues should point to the containing VPDef");
387 assert(D->getNumUsers() == 0 &&
388 "all defined VPValues should have no more users");
389 D->Def = nullptr;
390 delete D;
391 }
392 }
393
394 /// Returns the only VPValue defined by the VPDef. Can only be called for
395 /// VPDefs with a single defined value.
397 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
398 assert(DefinedValues[0] && "defined value must be non-null");
399 return DefinedValues[0];
400 }
401 const VPValue *getVPSingleValue() const {
402 assert(DefinedValues.size() == 1 && "must have exactly one defined value");
403 assert(DefinedValues[0] && "defined value must be non-null");
404 return DefinedValues[0];
405 }
406
407 /// Returns the VPValue with index \p I defined by the VPDef.
408 VPValue *getVPValue(unsigned I) {
409 assert(DefinedValues[I] && "defined value must be non-null");
410 return DefinedValues[I];
411 }
412 const VPValue *getVPValue(unsigned I) const {
413 assert(DefinedValues[I] && "defined value must be non-null");
414 return DefinedValues[I];
415 }
416
417 /// Returns an ArrayRef of the values defined by the VPDef.
418 ArrayRef<VPValue *> definedValues() { return DefinedValues; }
419 /// Returns an ArrayRef of the values defined by the VPDef.
420 ArrayRef<VPValue *> definedValues() const { return DefinedValues; }
421
422 /// Returns the number of values defined by the VPDef.
423 unsigned getNumDefinedValues() const { return DefinedValues.size(); }
424
425 /// \return an ID for the concrete type of this object.
426 /// This is used to implement the classof checks. This should not be used
427 /// for any other purpose, as the values may change as LLVM evolves.
428 unsigned getVPDefID() const { return SubclassID; }
429
430#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
431 /// Dump the VPDef to stderr (for debugging).
432 void dump() const;
433
434 /// Each concrete VPDef prints itself.
435 virtual void print(raw_ostream &O, const Twine &Indent,
436 VPSlotTracker &SlotTracker) const = 0;
437#endif
438};
439
440class VPlan;
441class VPBasicBlock;
442
443/// This class can be used to assign names to VPValues. For VPValues without
444/// underlying value, assign consecutive numbers and use those as names (wrapped
445/// in vp<>). Otherwise, use the name from the underlying value (wrapped in
446/// ir<>), appending a .V version number if there are multiple uses of the same
447/// name. Allows querying names for VPValues for printing, similar to the
448/// ModuleSlotTracker for IR values.
450 /// Keep track of versioned names assigned to VPValues with underlying IR
451 /// values.
453 /// Keep track of the next number to use to version the base name.
454 StringMap<unsigned> BaseName2Version;
455
456 /// Number to assign to the next VPValue without underlying value.
457 unsigned NextSlot = 0;
458
459 void assignName(const VPValue *V);
460 void assignNames(const VPlan &Plan);
461 void assignNames(const VPBasicBlock *VPBB);
462
463public:
464 VPSlotTracker(const VPlan *Plan = nullptr) {
465 if (Plan)
466 assignNames(*Plan);
467 }
468
469 /// Returns the name assigned to \p V, if there is one, otherwise try to
470 /// construct one from the underlying value, if there's one; else return
471 /// <badref>.
472 std::string getOrCreateName(const VPValue *V) const;
473};
474
475} // namespace llvm
476
477#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:696
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:591
typename SuperClass::iterator iterator
Definition: SmallVector.h:590
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
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:2844
VPlan-based builder utility analogous to IRBuilder.
This class augments a recipe with a set of VPValues defined by the recipe.
Definition: VPlanValue.h:308
void dump() const
Dump the VPDef to stderr (for debugging).
Definition: VPlan.cpp:110
unsigned getNumDefinedValues() const
Returns the number of values defined by the VPDef.
Definition: VPlanValue.h:423
virtual ~VPDef()
Definition: VPlanValue.h:383
ArrayRef< VPValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:418
VPValue * getVPSingleValue()
Returns the only VPValue defined by the VPDef.
Definition: VPlanValue.h:396
const VPValue * getVPSingleValue() const
Definition: VPlanValue.h:401
ArrayRef< VPValue * > definedValues() const
Returns an ArrayRef of the values defined by the VPDef.
Definition: VPlanValue.h:420
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:408
enum { VPBranchOnMaskSC, VPDerivedIVSC, VPExpandSCEVSC, VPInstructionSC, VPInterleaveSC, VPReductionSC, VPReplicateSC, VPScalarCastSC, VPScalarIVStepsSC, VPVectorPointerSC, VPWidenCallSC, VPWidenCanonicalIVSC, VPWidenCastSC, VPWidenGEPSC, VPWidenLoadEVLSC, VPWidenLoadSC, VPWidenStoreEVLSC, VPWidenStoreSC, VPWidenSC, VPWidenSelectSC, VPBlendSC, VPWidenPHISC, VPPredInstPHISC, VPCanonicalIVPHISC, VPActiveLaneMaskPHISC, VPEVLBasedIVPHISC, VPFirstOrderRecurrencePHISC, VPWidenIntOrFpInductionSC, VPWidenPointerInductionSC, 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:379
unsigned getVPDefID() const
Definition: VPlanValue.h:428
VPDef(const unsigned char SC)
Definition: VPlanValue.h:381
const VPValue * getVPValue(unsigned I) const
Definition: VPlanValue.h:412
This is a concrete Recipe that models a single VPlan-level instruction.
Definition: VPlan.h:1180
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition: VPlan.h:726
This class can be used to assign names to VPValues.
Definition: VPlanValue.h:449
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:1439
VPSlotTracker(const VPlan *Plan=nullptr)
Definition: VPlanValue.h:464
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition: VPlanValue.h:203
void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const
Print the operands to O.
Definition: VPlan.cpp:1324
operand_range operands()
Definition: VPlanValue.h:273
void setOperand(unsigned I, VPValue *New)
Definition: VPlanValue.h:258
VPUser & operator=(const VPUser &)=delete
unsigned getNumOperands() const
Definition: VPlanValue.h:252
SmallVectorImpl< VPValue * >::const_iterator const_operand_iterator
Definition: VPlanValue.h:265
VPUser(ArrayRef< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:222
const_operand_iterator op_begin() const
Definition: VPlanValue.h:270
operand_iterator op_end()
Definition: VPlanValue.h:271
const_operand_range operands() const
Definition: VPlanValue.h:274
operand_iterator op_begin()
Definition: VPlanValue.h:269
VPValue * getOperand(unsigned N) const
Definition: VPlanValue.h:253
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:288
VPUserID
Subclass identifier (for isa/dyn_cast).
Definition: VPlanValue.h:206
iterator_range< const_operand_iterator > const_operand_range
Definition: VPlanValue.h:267
VPUser(iterator_range< IterT > Operands, VPUserID ID)
Definition: VPlanValue.h:231
SmallVectorImpl< VPValue * >::iterator operand_iterator
Definition: VPlanValue.h:264
virtual ~VPUser()
Definition: VPlanValue.h:240
virtual bool onlyFirstPartUsed(const VPValue *Op) const
Returns true if the VPUser only uses the first part of operand Op.
Definition: VPlanValue.h:296
const_operand_iterator op_end() const
Definition: VPlanValue.h:272
virtual bool usesScalars(const VPValue *Op) const
Returns true if the VPUser uses scalars of operand Op.
Definition: VPlanValue.h:280
iterator_range< operand_iterator > operand_range
Definition: VPlanValue.h:266
void addOperand(VPValue *Operand)
Definition: VPlanValue.h:247
VPUser(std::initializer_list< VPValue * > Operands, VPUserID ID)
Definition: VPlanValue.h:227
VPUserID getVPUserID() const
Definition: VPlanValue.h:245
bool hasDefiningRecipe() const
Returns true if this VPValue is defined by a recipe.
Definition: VPlanValue.h:165
VPValue(Value *UV=nullptr)
Create a live-in VPValue.
Definition: VPlanValue.h:89
Value * getUnderlyingValue()
Return the underlying Value attached to this VPValue.
Definition: VPlanValue.h:77
@ VPVRecipeSC
A generic VPValue, like live-in values or defined by a recipe that defines multiple values.
Definition: VPlanValue.h:85
bool hasMoreThanOneUniqueUser()
Returns true if the value has more than one unique user.
Definition: VPlanValue.h:139
unsigned getVPValueID() const
Definition: VPlanValue.h:102
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition: VPlan.cpp:119
void printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:1320
void removeUser(VPUser &User)
Remove a single User from the list of users.
Definition: VPlanValue.h:116
SmallVectorImpl< VPUser * >::const_iterator const_user_iterator
Definition: VPlanValue.h:125
const_user_iterator user_begin() const
Definition: VPlanValue.h:130
const Value * getLiveInIRValue() const
Definition: VPlanValue.h:178
void addUser(VPUser &User)
Definition: VPlanValue.h:113
Value * UnderlyingVal
Definition: VPlanValue.h:60
VPValue(Value *UV, VPDef *Def)
Create a VPValue for a Def which defines multiple values.
Definition: VPlanValue.h:93
const_user_range users() const
Definition: VPlanValue.h:134
VPValue(const VPValue &)=delete
VPValue & operator=(const VPValue &)=delete
void dump() const
Dump the value to stderr (for debugging).
Definition: VPlan.cpp:102
void setUnderlyingValue(Value *Val)
Definition: VPlanValue.h:190
virtual ~VPValue()
Definition: VPlan.cpp:88
SmallVectorImpl< VPUser * >::iterator user_iterator
Definition: VPlanValue.h:124
iterator_range< user_iterator > user_range
Definition: VPlanValue.h:126
const_user_iterator user_end() const
Definition: VPlanValue.h:132
void print(raw_ostream &OS, VPSlotTracker &Tracker) const
Definition: VPlan.cpp:95
void replaceAllUsesWith(VPValue *New)
Definition: VPlan.cpp:1288
VPValue(VPDef *Def, Value *UV=nullptr)
Create a VPValue for a Def which is a subclass of VPValue.
Definition: VPlanValue.h:91
user_iterator user_begin()
Definition: VPlanValue.h:129
unsigned getNumUsers() const
Definition: VPlanValue.h:112
Value * getLiveInIRValue()
Returns the underlying IR value, if this VPValue is defined outside the scope of VPlan.
Definition: VPlanValue.h:173
const Value * getUnderlyingValue() const
Definition: VPlanValue.h:78
user_iterator user_end()
Definition: VPlanValue.h:131
bool isLiveIn() const
Returns true if this VPValue is a live-in, i.e. defined outside the VPlan.
Definition: VPlanValue.h:168
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:1292
user_range users()
Definition: VPlanValue.h:133
VPDef * Def
Pointer to the VPDef that defines this VPValue.
Definition: VPlanValue.h:64
iterator_range< const_user_iterator > const_user_range
Definition: VPlanValue.h:127
bool isDefinedOutsideVectorRegions() const
Returns true if the VPValue is defined outside any vector regions, i.e.
Definition: VPlanValue.h:187
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:3120
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:1742
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:656
void erase(Container &C, ValueType V)
Wrapper function to remove a value from a container:
Definition: STLExtras.h:2059
DenseMap< VPValue *, Value * > VPValue2ValueTy
Definition: VPlanValue.h:197
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:293
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1879
DenseMap< Value *, VPValue * > Value2VPValueTy
Definition: VPlanValue.h:196
#define N