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