LLVM 23.0.0git
VecUtils.h
Go to the documentation of this file.
1//===- VecUtils.h -----------------------------------------------*- C++ -*-===//
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// Collector for SandboxVectorizer related convenience functions that don't
10// belong in other classes.
11
12#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H
13#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H
14
16#include "llvm/IR/DataLayout.h"
17#include "llvm/SandboxIR/Type.h"
20#include <iterator>
21
22namespace llvm {
23/// Traits for DenseMap.
24template <> struct DenseMapInfo<SmallVector<sandboxir::Value *>> {
28 static unsigned getHashValue(const SmallVector<sandboxir::Value *> &Vec) {
29 return hash_combine_range(Vec);
30 }
33 return Vec1 == Vec2;
34 }
35};
36
37namespace sandboxir {
38
39class VecUtils {
40public:
41 /// \Returns the number of elements in \p Ty. That is the number of lanes if a
42 /// fixed vector or 1 if scalar. ScalableVectors have unknown size and
43 /// therefore are unsupported.
44 static int getNumElements(Type *Ty) {
46 return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getNumElements() : 1;
47 }
48 /// Returns \p Ty if scalar or its element type if vector.
49 static Type *getElementType(Type *Ty) {
50 return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getElementType() : Ty;
51 }
52
53 /// \Returns true if \p I1 and \p I2 are load/stores accessing consecutive
54 /// memory addresses.
55 template <typename LoadOrStoreT>
56 static bool areConsecutive(LoadOrStoreT *I1, LoadOrStoreT *I2,
57 ScalarEvolution &SE, const DataLayout &DL) {
58 static_assert(std::is_same<LoadOrStoreT, LoadInst>::value ||
59 std::is_same<LoadOrStoreT, StoreInst>::value,
60 "Expected Load or Store!");
61 auto Diff = Utils::getPointerDiffInBytes(I1, I2, SE);
62 if (!Diff)
63 return false;
64 int ElmBytes = Utils::getNumBits(I1) / 8;
65 return *Diff == ElmBytes;
66 }
67
68 template <typename LoadOrStoreT, typename ValT>
70 const DataLayout &DL) {
71 static_assert(std::is_same<LoadOrStoreT, LoadInst>::value ||
72 std::is_same<LoadOrStoreT, StoreInst>::value,
73 "Expected Load or Store!");
74 assert(isa<LoadOrStoreT>(Bndl[0]) && "Expected Load or Store!");
75 auto *LastLS = cast<LoadOrStoreT>(Bndl[0]);
76 for (Value *V : drop_begin(Bndl)) {
78 "Unimplemented: we only support StoreInst!");
79 auto *LS = cast<LoadOrStoreT>(V);
80 if (!VecUtils::areConsecutive(LastLS, LS, SE, DL))
81 return false;
82 LastLS = LS;
83 }
84 return true;
85 }
86
87 /// \Returns the number of vector lanes of \p Ty or 1 if not a vector.
88 /// NOTE: It asserts that \p Ty is a fixed vector type.
89 static unsigned getNumLanes(Type *Ty) {
90 assert(!isa<ScalableVectorType>(Ty) && "Expect scalar or fixed vector");
91 if (auto *FixedVecTy = dyn_cast<FixedVectorType>(Ty))
92 return FixedVecTy->getNumElements();
93 return 1u;
94 }
95
96 /// \Returns the expected vector lanes of \p V or 1 if not a vector.
97 /// NOTE: It asserts that \p V is a fixed vector.
98 static unsigned getNumLanes(Value *V) {
100 }
101
102 /// \Returns the total number of lanes across all values in \p Bndl.
103 static unsigned getNumLanes(ArrayRef<Value *> Bndl) {
104 unsigned Lanes = 0;
105 for (Value *V : Bndl)
106 Lanes += getNumLanes(V);
107 return Lanes;
108 }
109
110 /// \Returns <NumElts x ElemTy>.
111 /// It works for both scalar and vector \p ElemTy.
112 static Type *getWideType(Type *ElemTy, unsigned NumElts) {
113 if (ElemTy->isVectorTy()) {
114 auto *VecTy = cast<FixedVectorType>(ElemTy);
115 ElemTy = VecTy->getElementType();
116 NumElts = VecTy->getNumElements() * NumElts;
117 }
118 return FixedVectorType::get(ElemTy, NumElts);
119 }
120 /// \Returns the combined vector type for \p Bndl, even when the element types
121 /// differ. For example: i8,i8,i16 will return <4 x i8>. \Returns null if
122 /// types are of mixed float/integer types.
124 const DataLayout &DL) {
125 assert(!Bndl.empty() && "Expected non-empty Bndl!");
126 unsigned TotalBits = 0;
127 unsigned MinElmBits = std::numeric_limits<unsigned>::max();
128 Type *MinElmTy = nullptr;
129 for (auto [Idx, V] : enumerate(Bndl)) {
131
132 unsigned ElmBits = Utils::getNumBits(ElmTy, DL);
133 TotalBits += ElmBits * VecUtils::getNumLanes(V);
134 if (ElmBits < MinElmBits) {
135 MinElmBits = ElmBits;
136 MinElmTy = ElmTy;
137 }
138 }
139 unsigned NumElms = TotalBits / MinElmBits;
140 return FixedVectorType::get(MinElmTy, NumElms);
141 }
142 /// \Returns the instruction in \p Instrs that is lowest in the BB. Expects
143 /// that all instructions are in the same BB.
145 Instruction *LowestI = Instrs.front();
146 for (auto *I : drop_begin(Instrs)) {
147 if (LowestI->comesBefore(I))
148 LowestI = I;
149 }
150 return LowestI;
151 }
152 /// \Returns the lowest instruction in \p Vals, or nullptr if no instructions
153 /// are found. Skips instructions not in \p BB.
155 // Find the first Instruction in Vals that is also in `BB`.
156 auto It = find_if(Vals, [BB](Value *V) {
157 return isa<Instruction>(V) && cast<Instruction>(V)->getParent() == BB;
158 });
159 // If we couldn't find an instruction return nullptr.
160 if (It == Vals.end())
161 return nullptr;
162 Instruction *FirstI = cast<Instruction>(*It);
163 // Now look for the lowest instruction in Vals starting from one position
164 // after FirstI.
165 Instruction *LowestI = FirstI;
166 for (auto *V : make_range(std::next(It), Vals.end())) {
167 auto *I = dyn_cast<Instruction>(V);
168 // Skip non-instructions.
169 if (I == nullptr)
170 continue;
171 // Skips instructions not in \p BB.
172 if (I->getParent() != BB)
173 continue;
174 // If `LowestI` comes before `I` then `I` is the new lowest.
175 if (LowestI->comesBefore(I))
176 LowestI = I;
177 }
178 return LowestI;
179 }
180
181 /// If \p I is not a PHI it returns it. Else it walks down the instruction
182 /// chain looking for the last PHI and returns it. \Returns nullptr if \p I is
183 /// nullptr.
185 Instruction *LastI = I;
186 while (I != nullptr && isa<PHINode>(I)) {
187 LastI = I;
188 I = I->getNextNode();
189 }
190 return LastI;
191 }
192
193 /// If all values in \p Bndl are of the same scalar type then return it,
194 /// otherwise return nullptr.
196 Value *V0 = Bndl[0];
197 Type *Ty0 = Utils::getExpectedType(V0);
198 Type *ScalarTy = VecUtils::getElementType(Ty0);
199 for (auto *V : drop_begin(Bndl)) {
201 Type *NScalarTy = VecUtils::getElementType(NTy);
202 if (NScalarTy != ScalarTy)
203 return nullptr;
204 }
205 return ScalarTy;
206 }
207
208 /// Similar to tryGetCommonScalarType() but will assert that there is a common
209 /// type. So this is faster in release builds as it won't iterate through the
210 /// values.
212 Value *V0 = Bndl[0];
213 Type *Ty0 = Utils::getExpectedType(V0);
214 Type *ScalarTy = VecUtils::getElementType(Ty0);
215 assert(tryGetCommonScalarType(Bndl) && "Expected common scalar type!");
216 return ScalarTy;
217 }
218 /// \Returns the first integer power of 2 that is <= Num.
219 LLVM_ABI static unsigned getFloorPowerOf2(unsigned Num);
220
221 /// Helper struct for `matchPack()`. Describes the instructions and operands
222 /// of a pack pattern.
223 struct PackPattern {
224 /// The insertelement instructions that form the pack pattern in bottom-up
225 /// order, i.e., the first instruction in `Instrs` is the bottom-most
226 /// InsertElement instruction of the pack pattern.
227 /// For example in this simple pack pattern:
228 /// %Pack0 = insertelement <2 x i8> poison, i8 %v0, i64 0
229 /// %Pack1 = insertelement <2 x i8> %Pack0, i8 %v1, i64 1
230 /// this is [ %Pack1, %Pack0 ].
232 /// The "external" operands of the pack pattern, i.e., the values that get
233 /// packed into a vector, skipping the ones in `Instrs`. The operands are in
234 /// bottom-up order, starting from the operands of the bottom-most insert.
235 /// So in our example this would be [ %v1, %v0 ].
237 };
238
239 /// If \p I is the last instruction of a pack pattern (i.e., an InsertElement
240 /// into a vector), then this function returns the instructions in the pack
241 /// and the operands in the pack, else returns nullopt.
242 /// Here is an example of a matched pattern:
243 /// %PackA0 = insertelement <2 x i8> poison, i8 %v0, i64 0
244 /// %PackA1 = insertelement <2 x i8> %PackA0, i8 %v1, i64 1
245 /// TODO: this currently detects only simple canonicalized patterns.
246 static std::optional<PackPattern> matchPack(Instruction *I) {
247 // TODO: Support vector pack patterns.
248 // TODO: Support out-of-order inserts.
249
250 // Early return if `I` is not an Insert.
252 return std::nullopt;
253 auto *BB0 = I->getParent();
254 // The pack contains as many instrs as the lanes of the bottom-most Insert
255 unsigned ExpectedNumInserts = VecUtils::getNumLanes(I);
256 assert(ExpectedNumInserts >= 2 && "Expected at least 2 inserts!");
258 Pack.Operands.resize(ExpectedNumInserts);
259 // Collect the inserts by walking up the use-def chain.
260 Instruction *InsertI = I;
261 for (auto ExpectedLane : reverse(seq<unsigned>(ExpectedNumInserts))) {
262 if (InsertI == nullptr)
263 return std::nullopt;
264 if (InsertI->getParent() != BB0)
265 return std::nullopt;
266 // Check the lane.
267 auto *LaneC = dyn_cast<ConstantInt>(InsertI->getOperand(2));
268 if (LaneC == nullptr || LaneC->getSExtValue() != ExpectedLane)
269 return std::nullopt;
270 Pack.Instrs.push_back(InsertI);
271 Pack.Operands[ExpectedLane] = InsertI->getOperand(1);
272
273 Value *Op = InsertI->getOperand(0);
274 if (ExpectedLane == 0) {
275 // Check the topmost insert. The operand should be a Poison.
276 if (!isa<PoisonValue>(Op))
277 return std::nullopt;
278 } else {
280 }
281 }
282 return Pack;
283 }
284
285 /// Emits the necessary instruction sequence to extract element of type \p
286 /// ExtrTy at \p Lane from \p FromVec. Emits instructions before \p WhereIt.
287 /// Returns the extracted value.
288 /// Note: This handles both vectors and scalars. In the vector case it
289 /// extracts an N-wide element (with N dictated by \p ExtrTy).
290 static Value *unpack(Value *FromVec, Type *ExtrTy, unsigned Lane,
291 BasicBlock::iterator WhereIt) {
292 assert(isa<FixedVectorType>(FromVec->getType()) && "Expected vector!");
293 auto &Ctx = FromVec->getContext();
294 if (!ExtrTy->isVectorTy()) {
295 // For scalar elements we emit a single ExtractElementInst.
296 assert(Lane <
297 cast<FixedVectorType>(FromVec->getType())->getNumElements() &&
298 "Out of bounds!");
299 assert(ExtrTy ==
300 cast<FixedVectorType>(FromVec->getType())->getElementType() &&
301 "Expected same element type!");
302 Constant *ExtractLaneC =
304 // Note: This may be folded into a Constant if FromVec is a Constant.
305 return ExtractElementInst::create(FromVec, ExtractLaneC, WhereIt, Ctx,
306 "Unpack");
307 }
308 // For vector elements we emit a shuffle.
309 // For example, extracting lanes 2 and 3 of a <4 x i32> vector %vec:
310 // shufflevector <4 x i32> %vec, <4 x i32> poison, <2 x i32> <i32 2, i32 3>
311 auto *VecTy = cast<FixedVectorType>(FromVec->getType());
312 auto *ExtrVecTy = cast<FixedVectorType>(ExtrTy);
313 assert(ExtrVecTy->getElementType() == VecTy->getElementType() &&
314 "Expected same element type!");
316 for (unsigned Idx = 0, E = ExtrVecTy->getNumElements(); Idx != E; ++Idx) {
317 int MaskLane = Lane + Idx;
318 assert((unsigned)MaskLane <
319 cast<FixedVectorType>(FromVec->getType())->getNumElements() &&
320 "Out of bounds!");
321 Mask.push_back(MaskLane);
322 }
323 return ShuffleVectorInst::create(FromVec, PoisonValue::get(VecTy), Mask,
324 WhereIt, Ctx, "Unpack");
325 }
326
327 /// Iterate over all lanes and Value pairs.
328 // For example, given a range: {i32 %v0, <2 x i32> %v1, i32 %v2} we get:
329 // Lane Elm
330 // 0 %v0
331 // 1 %v1
332 // 3 %v2
333 template <typename RangeIteratorT> class LaneValueEnumerator {
334 /// Points to current element.
335 RangeIteratorT It;
336 RangeIteratorT ItE;
337 /// Accumulator of lanes.
338 unsigned Lane;
339
340 public:
341 // Note that We can start counting from a non-zero BeginLane, though the
342 // user must make sure it corresponds to the correct lane matching Begin.
343 LaneValueEnumerator(RangeIteratorT Begin, RangeIteratorT End,
344 unsigned BeginLane)
345 : It(Begin), ItE(End), Lane(BeginLane) {}
346 using iterator_catecotry = std::input_iterator_tag;
347 // NOTE: dereference returns by value instead of by reference.
348 using value_type = std::pair<unsigned, Value *>;
349 using difference_type = std::ptrdiff_t;
350 using pointer = std::pair<unsigned, Value *> *;
351 using reference = std::pair<unsigned, Value *> &;
353 assert(It != ItE && "Already at end!");
354 auto *Ty = Utils::getExpectedType(*It);
355 if (auto *VecTy = dyn_cast<FixedVectorType>(Ty)) {
356 Lane += VecTy->getNumElements();
357 } else {
358 assert(!isa<VectorType>(Ty) && "Expected scalar type!");
359 Lane += 1;
360 }
361 ++It;
362 return *this;
363 }
364 value_type operator*() const { return {Lane, *It}; }
366 return It == Other.It;
367 }
369 return !(*this == Other);
370 }
371 };
372
373 /// Helper for creating LaneValueEnumerator ranges. Can be used in for loops
374 /// like: `for (auto [Lane, V] : enumerateLanes(Range))`
375 template <typename ValueContainerT>
376 static auto enumerateLanes(const ValueContainerT &Range) {
377 auto Begin = LaneValueEnumerator<decltype(Range.begin())>(Range.begin(),
378 Range.end(), 0);
379 auto End = LaneValueEnumerator<decltype(Range.begin())>(Range.end(),
380 Range.end(), 0);
381 return make_range(Begin, End);
382 }
383
384#ifndef NDEBUG
385 /// Helper dump function for debugging.
386 LLVM_DUMP_METHOD static void dump(ArrayRef<Value *> Bndl);
388#endif // NDEBUG
389};
390
391} // namespace sandboxir
392
393} // namespace llvm
394
395#endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI
Definition Compiler.h:213
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:661
#define I(x, y, z)
Definition MD5.cpp:57
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
const T & front() const
Get the first element.
Definition ArrayRef.h:144
iterator end() const
Definition ArrayRef.h:130
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
InstListType::iterator iterator
Instruction iterators...
Definition BasicBlock.h:170
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
The main scalar evolution driver.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
Definition Value.h:75
static LLVM_ABI ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
Definition Constant.cpp:56
static LLVM_ABI Value * create(Value *Vec, Value *Idx, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Definition Instruction.h:43
bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
LLVM_ABI BasicBlock * getParent() const
\Returns the BasicBlock containing this Instruction, or null if it is detached.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
Definition Constant.cpp:263
static LLVM_ABI Value * create(Value *V1, Value *V2, Value *Mask, InsertPosition Pos, Context &Ctx, const Twine &Name="")
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Definition Type.h:50
static LLVM_ABI IntegerType * getInt32Ty(Context &Ctx)
Definition Type.cpp:21
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:214
Value * getOperand(unsigned OpIdx) const
Definition User.h:123
static std::optional< int > getPointerDiffInBytes(LoadOrStoreT *I0, LoadOrStoreT *I1, ScalarEvolution &SE)
\Returns the gap between the memory locations accessed by I0 and I1 in bytes.
Definition Utils.h:92
static unsigned getNumBits(Type *Ty, const DataLayout &DL)
\Returns the number of bits of Ty.
Definition Utils.h:66
static Type * getExpectedType(const Value *V)
\Returns the expected type of Value V.
Definition Utils.h:32
A SandboxIR Value has users. This is the base class.
Definition Value.h:72
LLVM_ABI Type * getType() const
Definition Value.cpp:46
Context & getContext() const
Definition Value.h:285
Iterate over all lanes and Value pairs.
Definition VecUtils.h:333
bool operator==(const LaneValueEnumerator &Other) const
Definition VecUtils.h:365
bool operator!=(const LaneValueEnumerator &Other) const
Definition VecUtils.h:368
std::pair< unsigned, Value * > value_type
Definition VecUtils.h:348
std::pair< unsigned, Value * > & reference
Definition VecUtils.h:351
LaneValueEnumerator(RangeIteratorT Begin, RangeIteratorT End, unsigned BeginLane)
Definition VecUtils.h:343
std::pair< unsigned, Value * > * pointer
Definition VecUtils.h:350
static Type * tryGetCommonScalarType(ArrayRef< Value * > Bndl)
If all values in Bndl are of the same scalar type then return it, otherwise return nullptr.
Definition VecUtils.h:195
static Instruction * getLowest(ArrayRef< Instruction * > Instrs)
\Returns the instruction in Instrs that is lowest in the BB.
Definition VecUtils.h:144
static Type * getCommonScalarType(ArrayRef< Value * > Bndl)
Similar to tryGetCommonScalarType() but will assert that there is a common type.
Definition VecUtils.h:211
static int getNumElements(Type *Ty)
\Returns the number of elements in Ty.
Definition VecUtils.h:44
static std::optional< PackPattern > matchPack(Instruction *I)
If I is the last instruction of a pack pattern (i.e., an InsertElement into a vector),...
Definition VecUtils.h:246
static Type * getCombinedVectorTypeFor(ArrayRef< Instruction * > Bndl, const DataLayout &DL)
\Returns the combined vector type for Bndl, even when the element types differ.
Definition VecUtils.h:123
static Instruction * getLastPHIOrSelf(Instruction *I)
If I is not a PHI it returns it.
Definition VecUtils.h:184
static unsigned getNumLanes(Type *Ty)
\Returns the number of vector lanes of Ty or 1 if not a vector.
Definition VecUtils.h:89
static Instruction * getLowest(ArrayRef< Value * > Vals, BasicBlock *BB)
\Returns the lowest instruction in Vals, or nullptr if no instructions are found.
Definition VecUtils.h:154
static Value * unpack(Value *FromVec, Type *ExtrTy, unsigned Lane, BasicBlock::iterator WhereIt)
Emits the necessary instruction sequence to extract element of type ExtrTy at Lane from FromVec.
Definition VecUtils.h:290
static LLVM_DUMP_METHOD void dump(ArrayRef< Value * > Bndl)
Helper dump function for debugging.
Definition VecUtils.cpp:28
static Type * getWideType(Type *ElemTy, unsigned NumElts)
\Returns <NumElts x ElemTy>.
Definition VecUtils.h:112
static auto enumerateLanes(const ValueContainerT &Range)
Helper for creating LaneValueEnumerator ranges.
Definition VecUtils.h:376
static bool areConsecutive(LoadOrStoreT *I1, LoadOrStoreT *I2, ScalarEvolution &SE, const DataLayout &DL)
\Returns true if I1 and I2 are load/stores accessing consecutive memory addresses.
Definition VecUtils.h:56
static bool areConsecutive(ArrayRef< ValT * > Bndl, ScalarEvolution &SE, const DataLayout &DL)
Definition VecUtils.h:69
static Type * getElementType(Type *Ty)
Returns Ty if scalar or its element type if vector.
Definition VecUtils.h:49
static unsigned getNumLanes(Value *V)
\Returns the expected vector lanes of V or 1 if not a vector.
Definition VecUtils.h:98
static unsigned getNumLanes(ArrayRef< Value * > Bndl)
\Returns the total number of lanes across all values in Bndl.
Definition VecUtils.h:103
static LLVM_ABI unsigned getFloorPowerOf2(unsigned Num)
\Returns the first integer power of 2 that is <= Num.
Definition VecUtils.cpp:13
BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)
Definition BasicBlock.h:75
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
Definition STLExtras.h:315
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Definition STLExtras.h:2553
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
auto reverse(ContainerTy &&C)
Definition STLExtras.h:407
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
@ Other
Any other memory.
Definition ModRef.h:68
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1771
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
Definition Sequence.h:305
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition Hashing.h:305
static bool isEqual(const SmallVector< sandboxir::Value * > &Vec1, const SmallVector< sandboxir::Value * > &Vec2)
Definition VecUtils.h:31
static SmallVector< sandboxir::Value * > getEmptyKey()
Definition VecUtils.h:25
static unsigned getHashValue(const SmallVector< sandboxir::Value * > &Vec)
Definition VecUtils.h:28
An information struct used to provide DenseMap with the various necessary components for a given valu...
Helper struct for matchPack().
Definition VecUtils.h:223
SmallVector< Value * > Operands
The "external" operands of the pack pattern, i.e., the values that get packed into a vector,...
Definition VecUtils.h:236
SmallVector< Instruction * > Instrs
The insertelement instructions that form the pack pattern in bottom-up order, i.e....
Definition VecUtils.h:231