LLVM 17.0.0git
LoopVectorizationLegality.h
Go to the documentation of this file.
1//===- llvm/Transforms/Vectorize/LoopVectorizationLegality.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/// \file
10/// This file defines the LoopVectorizationLegality class. Original code
11/// in Loop Vectorizer has been moved out to its own file for modularity
12/// and reusability.
13///
14/// Currently, it works for innermost loop vectorization. Extending this to
15/// outer loop vectorization is a TODO item.
16///
17/// Also provides:
18/// 1) LoopVectorizeHints class which keeps a number of loop annotations
19/// locally for easy look up. It has the ability to write them back as
20/// loop metadata, upon request.
21/// 2) LoopVectorizationRequirements class for lazy bail out for the purpose
22/// of reporting useful failure to vectorize message.
23//
24//===----------------------------------------------------------------------===//
25
26#ifndef LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H
27#define LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H
28
29#include "llvm/ADT/MapVector.h"
33
34namespace llvm {
35class AAResults;
36class AssumptionCache;
37class BasicBlock;
38class BlockFrequencyInfo;
39class DemandedBits;
40class DominatorTree;
41class Function;
42class Loop;
43class LoopInfo;
44class Metadata;
45class OptimizationRemarkEmitter;
46class PredicatedScalarEvolution;
47class ProfileSummaryInfo;
48class TargetLibraryInfo;
49class TargetTransformInfo;
50class Type;
51
52/// Utility class for getting and setting loop vectorizer hints in the form
53/// of loop metadata.
54/// This class keeps a number of loop annotations locally (as member variables)
55/// and can, upon request, write them back as metadata on the loop. It will
56/// initially scan the loop for existing metadata, and will update the local
57/// values based on information in the loop.
58/// We cannot write all values to metadata, as the mere presence of some info,
59/// for example 'force', means a decision has been made. So, we need to be
60/// careful NOT to add them if the user hasn't specifically asked so.
62 enum HintKind {
63 HK_WIDTH,
64 HK_INTERLEAVE,
65 HK_FORCE,
66 HK_ISVECTORIZED,
67 HK_PREDICATE,
68 HK_SCALABLE
69 };
70
71 /// Hint - associates name and validation with the hint value.
72 struct Hint {
73 const char *Name;
74 unsigned Value; // This may have to change for non-numeric values.
75 HintKind Kind;
76
77 Hint(const char *Name, unsigned Value, HintKind Kind)
78 : Name(Name), Value(Value), Kind(Kind) {}
79
80 bool validate(unsigned Val);
81 };
82
83 /// Vectorization width.
84 Hint Width;
85
86 /// Vectorization interleave factor.
87 Hint Interleave;
88
89 /// Vectorization forced
90 Hint Force;
91
92 /// Already Vectorized
93 Hint IsVectorized;
94
95 /// Vector Predicate
96 Hint Predicate;
97
98 /// Says whether we should use fixed width or scalable vectorization.
99 Hint Scalable;
100
101 /// Return the loop metadata prefix.
102 static StringRef Prefix() { return "llvm.loop."; }
103
104 /// True if there is any unsafe math in the loop.
105 bool PotentiallyUnsafe = false;
106
107public:
109 FK_Undefined = -1, ///< Not selected.
110 FK_Disabled = 0, ///< Forcing disabled.
111 FK_Enabled = 1, ///< Forcing enabled.
112 };
113
115 /// Not selected.
117 /// Disables vectorization with scalable vectors.
119 /// Vectorize loops using scalable vectors or fixed-width vectors, but favor
120 /// scalable vectors when the cost-model is inconclusive. This is the
121 /// default when the scalable.enable hint is enabled through a pragma.
123 };
124
125 LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced,
127 const TargetTransformInfo *TTI = nullptr);
128
129 /// Mark the loop L as already vectorized by setting the width to 1.
131
133 bool VectorizeOnlyWhenForced) const;
134
135 /// Dumps all the hint information.
136 void emitRemarkWithHints() const;
137
139 return ElementCount::get(Width.Value, (ScalableForceKind)Scalable.Value ==
141 }
142
143 unsigned getInterleave() const {
144 if (Interleave.Value)
145 return Interleave.Value;
146 // If interleaving is not explicitly set, assume that if we do not want
147 // unrolling, we also don't want any interleaving.
149 return 1;
150 return 0;
151 }
152 unsigned getIsVectorized() const { return IsVectorized.Value; }
153 unsigned getPredicate() const { return Predicate.Value; }
154 enum ForceKind getForce() const {
155 if ((ForceKind)Force.Value == FK_Undefined &&
157 return FK_Disabled;
158 return (ForceKind)Force.Value;
159 }
160
161 /// \return true if scalable vectorization has been explicitly disabled.
163 return (ScalableForceKind)Scalable.Value == SK_FixedWidthOnly;
164 }
165
166 /// If hints are provided that force vectorization, use the AlwaysPrint
167 /// pass name to force the frontend to print the diagnostic.
168 const char *vectorizeAnalysisPassName() const;
169
170 /// When enabling loop hints are provided we allow the vectorizer to change
171 /// the order of operations that is given by the scalar loop. This is not
172 /// enabled by default because can be unsafe or inefficient. For example,
173 /// reordering floating-point operations will change the way round-off
174 /// error accumulates in the loop.
175 bool allowReordering() const;
176
177 bool isPotentiallyUnsafe() const {
178 // Avoid FP vectorization if the target is unsure about proper support.
179 // This may be related to the SIMD unit in the target not handling
180 // IEEE 754 FP ops properly, or bad single-to-double promotions.
181 // Otherwise, a sequence of vectorized loops, even without reduction,
182 // could lead to different end results on the destination vectors.
183 return getForce() != LoopVectorizeHints::FK_Enabled && PotentiallyUnsafe;
184 }
185
186 void setPotentiallyUnsafe() { PotentiallyUnsafe = true; }
187
188private:
189 /// Find hints specified in the loop metadata and update local values.
190 void getHintsFromMetadata();
191
192 /// Checks string hint with one operand and set value if valid.
193 void setHint(StringRef Name, Metadata *Arg);
194
195 /// The loop these hints belong to.
196 const Loop *TheLoop;
197
198 /// Interface to emit optimization remarks.
200};
201
202/// This holds vectorization requirements that must be verified late in
203/// the process. The requirements are set by legalize and costmodel. Once
204/// vectorization has been determined to be possible and profitable the
205/// requirements can be verified by looking for metadata or compiler options.
206/// For example, some loops require FP commutativity which is only allowed if
207/// vectorization is explicitly specified or if the fast-math compiler option
208/// has been provided.
209/// Late evaluation of these requirements allows helpful diagnostics to be
210/// composed that tells the user what need to be done to vectorize the loop. For
211/// example, by specifying #pragma clang loop vectorize or -ffast-math. Late
212/// evaluation should be used only when diagnostics can generated that can be
213/// followed by a non-expert user.
215public:
216 /// Track the 1st floating-point instruction that can not be reassociated.
218 if (I && !ExactFPMathInst)
219 ExactFPMathInst = I;
220 }
221
222 Instruction *getExactFPInst() { return ExactFPMathInst; }
223
224private:
225 Instruction *ExactFPMathInst = nullptr;
226};
227
228/// LoopVectorizationLegality checks if it is legal to vectorize a loop, and
229/// to what vectorization factor.
230/// This class does not look at the profitability of vectorization, only the
231/// legality. This class has two main kinds of checks:
232/// * Memory checks - The code in canVectorizeMemory checks if vectorization
233/// will change the order of memory accesses in a way that will change the
234/// correctness of the program.
235/// * Scalars checks - The code in canVectorizeInstrs and canVectorizeMemory
236/// checks for a number of different conditions, such as the availability of a
237/// single induction variable, that all types are supported and vectorize-able,
238/// etc. This code reflects the capabilities of InnerLoopVectorizer.
239/// This class is also used by InnerLoopVectorizer for identifying
240/// induction variable and the different reduction variables.
242public:
249 : TheLoop(L), LI(LI), PSE(PSE), TTI(TTI), TLI(TLI), DT(DT), LAIs(LAIs),
250 ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC), BFI(BFI),
251 PSI(PSI) {}
252
253 /// ReductionList contains the reduction descriptors for all
254 /// of the reductions that were found in the loop.
256
257 /// InductionList saves induction variables and maps them to the
258 /// induction descriptor.
260
261 /// RecurrenceSet contains the phi nodes that are recurrences other than
262 /// inductions and reductions.
264
265 /// Returns true if it is legal to vectorize this loop.
266 /// This does not mean that it is profitable to vectorize this
267 /// loop, only that it is legal to do so.
268 /// Temporarily taking UseVPlanNativePath parameter. If true, take
269 /// the new code path being implemented for outer loop vectorization
270 /// (should be functional for inner loop vectorization) based on VPlan.
271 /// If false, good old LV code.
272 bool canVectorize(bool UseVPlanNativePath);
273
274 /// Returns true if it is legal to vectorize the FP math operations in this
275 /// loop. Vectorizing is legal if we allow reordering of FP operations, or if
276 /// we can use in-order reductions.
277 bool canVectorizeFPMath(bool EnableStrictReductions);
278
279 /// Return true if we can vectorize this loop while folding its tail by
280 /// masking, and mark all respective loads/stores for masking.
281 /// This object's state is only modified iff this function returns true.
283
284 /// Returns the primary induction variable.
285 PHINode *getPrimaryInduction() { return PrimaryInduction; }
286
287 /// Returns the reduction variables found in the loop.
288 const ReductionList &getReductionVars() const { return Reductions; }
289
290 /// Returns the induction variables found in the loop.
291 const InductionList &getInductionVars() const { return Inductions; }
292
293 /// Return the fixed-order recurrences found in the loop.
294 RecurrenceSet &getFixedOrderRecurrences() { return FixedOrderRecurrences; }
295
296 /// Returns the widest induction type.
297 Type *getWidestInductionType() { return WidestIndTy; }
298
299 /// Returns True if given store is a final invariant store of one of the
300 /// reductions found in the loop.
302
303 /// Returns True if given address is invariant and is used to store recurrent
304 /// expression
306
307 /// Returns True if V is a Phi node of an induction variable in this loop.
308 bool isInductionPhi(const Value *V) const;
309
310 /// Returns a pointer to the induction descriptor, if \p Phi is an integer or
311 /// floating point induction.
313
314 /// Returns a pointer to the induction descriptor, if \p Phi is pointer
315 /// induction.
317
318 /// Returns True if V is a cast that is part of an induction def-use chain,
319 /// and had been proven to be redundant under a runtime guard (in other
320 /// words, the cast has the same SCEV expression as the induction phi).
321 bool isCastedInductionVariable(const Value *V) const;
322
323 /// Returns True if V can be considered as an induction variable in this
324 /// loop. V can be the induction phi, or some redundant cast in the def-use
325 /// chain of the inducion phi.
326 bool isInductionVariable(const Value *V) const;
327
328 /// Returns True if PN is a reduction variable in this loop.
329 bool isReductionVariable(PHINode *PN) const { return Reductions.count(PN); }
330
331 /// Returns True if Phi is a fixed-order recurrence in this loop.
332 bool isFixedOrderRecurrence(const PHINode *Phi) const;
333
334 /// Return true if the block BB needs to be predicated in order for the loop
335 /// to be vectorized.
336 bool blockNeedsPredication(BasicBlock *BB) const;
337
338 /// Check if this pointer is consecutive when vectorizing. This happens
339 /// when the last index of the GEP is the induction variable, or that the
340 /// pointer itself is an induction variable.
341 /// This check allows us to vectorize A[idx] into a wide load/store.
342 /// Returns:
343 /// 0 - Stride is unknown or non-consecutive.
344 /// 1 - Address is consecutive.
345 /// -1 - Address is consecutive, and decreasing.
346 /// NOTE: This method must only be used before modifying the original scalar
347 /// loop. Do not use after invoking 'createVectorizedLoopSkeleton' (PR34965).
348 int isConsecutivePtr(Type *AccessTy, Value *Ptr) const;
349
350 /// Returns true if the value V is uniform within the loop.
351 bool isUniform(Value *V) const;
352
353 /// A uniform memory op is a load or store which accesses the same memory
354 /// location on all lanes.
355 bool isUniformMemOp(Instruction &I) const;
356
357 /// Returns the information that we collected about runtime memory check.
359 return LAI->getRuntimePointerChecking();
360 }
361
362 const LoopAccessInfo *getLAI() const { return LAI; }
363
366 }
367
368 unsigned getMaxSafeDepDistBytes() { return LAI->getMaxSafeDepDistBytes(); }
369
372 }
373
374 bool hasStride(Value *V) { return LAI->hasStride(V); }
375
376 /// Returns true if vector representation of the instruction \p I
377 /// requires mask.
378 bool isMaskRequired(const Instruction *I) const {
379 return MaskedOp.contains(I);
380 }
381
382 unsigned getNumStores() const { return LAI->getNumStores(); }
383 unsigned getNumLoads() const { return LAI->getNumLoads(); }
384
385 /// Returns all assume calls in predicated blocks. They need to be dropped
386 /// when flattening the CFG.
388 return ConditionalAssumes;
389 }
390
391private:
392 /// Return true if the pre-header, exiting and latch blocks of \p Lp and all
393 /// its nested loops are considered legal for vectorization. These legal
394 /// checks are common for inner and outer loop vectorization.
395 /// Temporarily taking UseVPlanNativePath parameter. If true, take
396 /// the new code path being implemented for outer loop vectorization
397 /// (should be functional for inner loop vectorization) based on VPlan.
398 /// If false, good old LV code.
399 bool canVectorizeLoopNestCFG(Loop *Lp, bool UseVPlanNativePath);
400
401 /// Set up outer loop inductions by checking Phis in outer loop header for
402 /// supported inductions (int inductions). Return false if any of these Phis
403 /// is not a supported induction or if we fail to find an induction.
404 bool setupOuterLoopInductions();
405
406 /// Return true if the pre-header, exiting and latch blocks of \p Lp
407 /// (non-recursive) are considered legal for vectorization.
408 /// Temporarily taking UseVPlanNativePath parameter. If true, take
409 /// the new code path being implemented for outer loop vectorization
410 /// (should be functional for inner loop vectorization) based on VPlan.
411 /// If false, good old LV code.
412 bool canVectorizeLoopCFG(Loop *Lp, bool UseVPlanNativePath);
413
414 /// Check if a single basic block loop is vectorizable.
415 /// At this point we know that this is a loop with a constant trip count
416 /// and we only need to check individual instructions.
417 bool canVectorizeInstrs();
418
419 /// When we vectorize loops we may change the order in which
420 /// we read and write from memory. This method checks if it is
421 /// legal to vectorize the code, considering only memory constrains.
422 /// Returns true if the loop is vectorizable
423 bool canVectorizeMemory();
424
425 /// Return true if we can vectorize this loop using the IF-conversion
426 /// transformation.
427 bool canVectorizeWithIfConvert();
428
429 /// Return true if we can vectorize this outer loop. The method performs
430 /// specific checks for outer loop vectorization.
431 bool canVectorizeOuterLoop();
432
433 /// Return true if all of the instructions in the block can be speculatively
434 /// executed, and record the loads/stores that require masking.
435 /// \p SafePtrs is a list of addresses that are known to be legal and we know
436 /// that we can read from them without segfault.
437 /// \p MaskedOp is a list of instructions that have to be transformed into
438 /// calls to the appropriate masked intrinsic when the loop is vectorized.
439 /// \p ConditionalAssumes is a list of assume instructions in predicated
440 /// blocks that must be dropped if the CFG gets flattened.
441 bool blockCanBePredicated(
444 SmallPtrSetImpl<Instruction *> &ConditionalAssumes) const;
445
446 /// Updates the vectorization state by adding \p Phi to the inductions list.
447 /// This can set \p Phi as the main induction of the loop if \p Phi is a
448 /// better choice for the main induction than the existing one.
449 void addInductionPhi(PHINode *Phi, const InductionDescriptor &ID,
450 SmallPtrSetImpl<Value *> &AllowedExit);
451
452 /// If an access has a symbolic strides, this maps the pointer value to
453 /// the stride symbol.
454 const ValueToValueMap *getSymbolicStrides() const {
455 // FIXME: Currently, the set of symbolic strides is sometimes queried before
456 // it's collected. This happens from canVectorizeWithIfConvert, when the
457 // pointer is checked to reference consecutive elements suitable for a
458 // masked access.
459 return LAI ? &LAI->getSymbolicStrides() : nullptr;
460 }
461
462 /// The loop that we evaluate.
463 Loop *TheLoop;
464
465 /// Loop Info analysis.
466 LoopInfo *LI;
467
468 /// A wrapper around ScalarEvolution used to add runtime SCEV checks.
469 /// Applies dynamic knowledge to simplify SCEV expressions in the context
470 /// of existing SCEV assumptions. The analysis will also add a minimal set
471 /// of new predicates if this is required to enable vectorization and
472 /// unrolling.
473 PredicatedScalarEvolution &PSE;
474
475 /// Target Transform Info.
476 TargetTransformInfo *TTI;
477
478 /// Target Library Info.
479 TargetLibraryInfo *TLI;
480
481 /// Dominator Tree.
482 DominatorTree *DT;
483
484 // LoopAccess analysis.
485 LoopAccessInfoManager &LAIs;
486
487 const LoopAccessInfo *LAI = nullptr;
488
489 /// Interface to emit optimization remarks.
490 OptimizationRemarkEmitter *ORE;
491
492 // --- vectorization state --- //
493
494 /// Holds the primary induction variable. This is the counter of the
495 /// loop.
496 PHINode *PrimaryInduction = nullptr;
497
498 /// Holds the reduction variables.
499 ReductionList Reductions;
500
501 /// Holds all of the induction variables that we found in the loop.
502 /// Notice that inductions don't need to start at zero and that induction
503 /// variables can be pointers.
504 InductionList Inductions;
505
506 /// Holds all the casts that participate in the update chain of the induction
507 /// variables, and that have been proven to be redundant (possibly under a
508 /// runtime guard). These casts can be ignored when creating the vectorized
509 /// loop body.
510 SmallPtrSet<Instruction *, 4> InductionCastsToIgnore;
511
512 /// Holds the phi nodes that are fixed-order recurrences.
513 RecurrenceSet FixedOrderRecurrences;
514
515 /// Holds instructions that need to sink past other instructions to handle
516 /// fixed-order recurrences.
517 MapVector<Instruction *, Instruction *> SinkAfter;
518
519 /// Holds the widest induction type encountered.
520 Type *WidestIndTy = nullptr;
521
522 /// Allowed outside users. This holds the variables that can be accessed from
523 /// outside the loop.
524 SmallPtrSet<Value *, 4> AllowedExit;
525
526 /// Vectorization requirements that will go through late-evaluation.
527 LoopVectorizationRequirements *Requirements;
528
529 /// Used to emit an analysis of any legality issues.
530 LoopVectorizeHints *Hints;
531
532 /// The demanded bits analysis is used to compute the minimum type size in
533 /// which a reduction can be computed.
534 DemandedBits *DB;
535
536 /// The assumption cache analysis is used to compute the minimum type size in
537 /// which a reduction can be computed.
538 AssumptionCache *AC;
539
540 /// While vectorizing these instructions we have to generate a
541 /// call to the appropriate masked intrinsic
542 SmallPtrSet<const Instruction *, 8> MaskedOp;
543
544 /// Assume instructions in predicated blocks must be dropped if the CFG gets
545 /// flattened.
546 SmallPtrSet<Instruction *, 8> ConditionalAssumes;
547
548 /// BFI and PSI are used to check for profile guided size optimizations.
549 BlockFrequencyInfo *BFI;
550 ProfileSummaryInfo *PSI;
551};
552
553} // namespace llvm
554
555#endif // LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
RelocType Type
Definition: COFFYAML.cpp:390
std::string Name
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define H(x, y, z)
Definition: MD5.cpp:57
This file implements a map that provides insertion order iteration.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
Definition: BasicBlock.h:56
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:166
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition: TypeSize.h:297
A struct for saving information about induction variables.
Drive the analysis of memory accesses in the loop.
const MemoryDepChecker & getDepChecker() const
the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences b...
const RuntimePointerChecking * getRuntimePointerChecking() const
unsigned getNumLoads() const
bool hasStride(Value *V) const
Pointer has a symbolic stride.
uint64_t getMaxSafeDepDistBytes() const
unsigned getNumStores() const
const ValueToValueMap & getSymbolicStrides() const
If an access has a symbolic strides, this maps the pointer value to the stride symbol.
LoopVectorizationLegality checks if it is legal to vectorize a loop, and to what vectorization factor...
MapVector< PHINode *, InductionDescriptor > InductionList
InductionList saves induction variables and maps them to the induction descriptor.
bool isInvariantStoreOfReduction(StoreInst *SI)
Returns True if given store is a final invariant store of one of the reductions found in the loop.
RecurrenceSet & getFixedOrderRecurrences()
Return the fixed-order recurrences found in the loop.
bool isInvariantAddressOfReduction(Value *V)
Returns True if given address is invariant and is used to store recurrent expression.
bool blockNeedsPredication(BasicBlock *BB) const
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
const SmallPtrSetImpl< Instruction * > & getConditionalAssumes() const
Returns all assume calls in predicated blocks.
bool canVectorize(bool UseVPlanNativePath)
Returns true if it is legal to vectorize this loop.
int isConsecutivePtr(Type *AccessTy, Value *Ptr) const
Check if this pointer is consecutive when vectorizing.
SmallPtrSet< const PHINode *, 8 > RecurrenceSet
RecurrenceSet contains the phi nodes that are recurrences other than inductions and reductions.
bool canVectorizeFPMath(bool EnableStrictReductions)
Returns true if it is legal to vectorize the FP math operations in this loop.
LoopVectorizationLegality(Loop *L, PredicatedScalarEvolution &PSE, DominatorTree *DT, TargetTransformInfo *TTI, TargetLibraryInfo *TLI, Function *F, LoopAccessInfoManager &LAIs, LoopInfo *LI, OptimizationRemarkEmitter *ORE, LoopVectorizationRequirements *R, LoopVectorizeHints *H, DemandedBits *DB, AssumptionCache *AC, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI)
bool isReductionVariable(PHINode *PN) const
Returns True if PN is a reduction variable in this loop.
bool isFixedOrderRecurrence(const PHINode *Phi) const
Returns True if Phi is a fixed-order recurrence in this loop.
const InductionDescriptor * getPointerInductionDescriptor(PHINode *Phi) const
Returns a pointer to the induction descriptor, if Phi is pointer induction.
const InductionDescriptor * getIntOrFpInductionDescriptor(PHINode *Phi) const
Returns a pointer to the induction descriptor, if Phi is an integer or floating point induction.
bool isInductionPhi(const Value *V) const
Returns True if V is a Phi node of an induction variable in this loop.
PHINode * getPrimaryInduction()
Returns the primary induction variable.
bool isUniform(Value *V) const
Returns true if the value V is uniform within the loop.
const InductionList & getInductionVars() const
Returns the induction variables found in the loop.
const ReductionList & getReductionVars() const
Returns the reduction variables found in the loop.
Type * getWidestInductionType()
Returns the widest induction type.
const LoopAccessInfo * getLAI() const
bool prepareToFoldTailByMasking()
Return true if we can vectorize this loop while folding its tail by masking, and mark all respective ...
MapVector< PHINode *, RecurrenceDescriptor > ReductionList
ReductionList contains the reduction descriptors for all of the reductions that were found in the loo...
bool isMaskRequired(const Instruction *I) const
Returns true if vector representation of the instruction I requires mask.
const RuntimePointerChecking * getRuntimePointerChecking() const
Returns the information that we collected about runtime memory check.
bool isUniformMemOp(Instruction &I) const
A uniform memory op is a load or store which accesses the same memory location on all lanes.
bool isInductionVariable(const Value *V) const
Returns True if V can be considered as an induction variable in this loop.
bool isCastedInductionVariable(const Value *V) const
Returns True if V is a cast that is part of an induction def-use chain, and had been proven to be red...
This holds vectorization requirements that must be verified late in the process.
void addExactFPMathInst(Instruction *I)
Track the 1st floating-point instruction that can not be reassociated.
Utility class for getting and setting loop vectorizer hints in the form of loop metadata.
@ SK_PreferScalable
Vectorize loops using scalable vectors or fixed-width vectors, but favor scalable vectors when the co...
@ SK_FixedWidthOnly
Disables vectorization with scalable vectors.
bool allowVectorization(Function *F, Loop *L, bool VectorizeOnlyWhenForced) const
bool allowReordering() const
When enabling loop hints are provided we allow the vectorizer to change the order of operations that ...
void emitRemarkWithHints() const
Dumps all the hint information.
void setAlreadyVectorized()
Mark the loop L as already vectorized by setting the width to 1.
const char * vectorizeAnalysisPassName() const
If hints are provided that force vectorization, use the AlwaysPrint pass name to force the frontend t...
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:547
size_type count(const KeyT &Key) const
Definition: MapVector.h:145
bool isSafeForAnyVectorWidth() const
Return true if the number of elements that are safe to operate on simultaneously is not bounded.
uint64_t getMaxSafeVectorWidthInBits() const
Return the number of elements that are safe to operate on simultaneously, multiplied by the size of t...
Root of the metadata hierarchy.
Definition: Metadata.h:61
The optimization diagnostic interface.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
Analysis providing profile information.
Holds information about the memory runtime legality checks to verify that a group of pointers do not ...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:344
An instruction for storing to memory.
Definition: Instructions.h:301
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Provides information about what library functions are available for the current target.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool hasDisableAllTransformsHint(const Loop *L)
Look for the loop attribute that disables all transformation heuristic.
Definition: LoopUtils.cpp:344
TransformationMode hasUnrollTransformation(const Loop *L)
Definition: LoopUtils.cpp:352
@ TM_Disable
The transformation should not be applied.
Definition: LoopUtils.h:281