15#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANHELPERS_H
16#define LLVM_TRANSFORMS_VECTORIZE_VPLANHELPERS_H
31class InnerLoopVectorizer;
76 "Both Start and End should have the same scalable flag");
78 "Expected Start to be a power of 2");
80 "Expected End to be a power of 2");
139 VPLane(
unsigned Lane,
Kind LaneKind) : Lane(Lane), LaneKind(LaneKind) {}
145 "trying to extract with invalid offset");
154 return VPLane(LaneOffset, LaneKind);
165 "can only get known lane from the beginning");
184 "ScalableLast can only be used with scalable VFs");
188 "Cannot extract lane larger than VF");
233 unsigned CacheIdx =
Lane.mapToCacheIndex(
VF);
234 return CacheIdx <
I->second.size() &&
I->second[CacheIdx];
245 "scalar values must be stored as (0, 0)");
258 unsigned CacheIdx =
Lane.mapToCacheIndex(
VF);
259 if (Scalars.size() <= CacheIdx)
260 Scalars.resize(CacheIdx + 1);
261 assert(!Scalars[CacheIdx] &&
"should overwrite existing value");
262 Scalars[CacheIdx] = V;
269 "need to overwrite existing value");
270 unsigned CacheIdx =
Lane.mapToCacheIndex(
VF);
271 assert(CacheIdx < Iter->second.size() &&
272 "need to overwrite existing value");
273 Iter->second[CacheIdx] = V;
397 unsigned NextSlot = 0;
399 void assignName(
const VPValue *V);
400 void assignNames(
const VPlan &Plan);
415#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
422 unsigned TabWidth = 2;
430 void bumpIndent(
int b) { Indent = std::string((
Depth += b) * TabWidth,
' '); }
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
BlockVerifier::State From
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseMap class.
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
LLVM Basic Block Representation.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
constexpr bool isScalar() const
Exactly one element.
Common base class shared among various IRBuilders.
InnerLoopVectorizer vectorizes loops which contain only one basic block to a specified vectorization ...
This is an important class for using LLVM in a threaded context.
LoopVectorizationCostModel - estimates the expected speedups due to vectorization.
This class emits a version of the loop where run-time checks ensure that may-alias pointers can't ove...
Represents a single loop in the control flow graph.
This class provides computation of slot numbers for LLVM Assembly writing.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Provides information about what library functions are available for the current target.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
Iterator to iterate over vectorization factors in a VFRange.
ElementCount operator*() const
iterator(ElementCount VF)
bool operator==(const iterator &Other) const
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
In what follows, the term "input IR" refers to code that is fed into the vectorizer whereas the term ...
static VPLane getLastLaneForVF(const ElementCount &VF)
Value * getAsRuntimeExpr(IRBuilderBase &Builder, const ElementCount &VF) const
Returns an expression describing the lane index that can be used at runtime.
VPLane(unsigned Lane, Kind LaneKind)
Kind getKind() const
Returns the Kind of lane offset.
static VPLane getLaneFromEnd(const ElementCount &VF, unsigned Offset)
bool isFirstLane() const
Returns true if this is the first lane of the whole vector.
unsigned getKnownLane() const
Returns a compile-time known value for the lane index and asserts if the lane can only be calculated ...
static VPLane getFirstLane()
Kind
Kind describes how to interpret Lane.
@ ScalableLast
For ScalableLast, Lane is the offset from the start of the last N-element subvector in a scalable vec...
@ First
For First, Lane is the index into the first N elements of a fixed-vector <N x <ElTy>> or a scalable v...
unsigned mapToCacheIndex(const ElementCount &VF) const
Maps the lane to a cache index based on VF.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
This class can be used to assign names to VPValues.
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...
VPSlotTracker(const VPlan *Plan=nullptr)
An analysis for type-inference for VPValues.
VPlanPrinter prints a given VPlan to a given output stream.
VPlanPrinter(raw_ostream &O, const VPlan &P)
LLVM_DUMP_METHOD void dump()
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVM Value Representation.
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
This class implements an extremely fast bulk output stream that can only output to a stream.
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.
Value * getRuntimeVF(IRBuilderBase &B, Type *Ty, ElementCount VF)
Return the runtime value for VF.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Value * createStepForVF(IRBuilderBase &B, Type *Ty, ElementCount VF, int64_t Step)
Return a value for Step multiplied by VF.
unsigned getReciprocalPredBlockProb()
A helper function that returns the reciprocal of the block probability of predicated blocks.
A range of powers-of-2 vectorization factors with fixed start and adjustable end.
VFRange(const ElementCount &Start, const ElementCount &End)
Struct to hold various analysis needed for cost computations.
LoopVectorizationCostModel & CM
VPCostContext(const TargetTransformInfo &TTI, const TargetLibraryInfo &TLI, Type *CanIVTy, LoopVectorizationCostModel &CM, TargetTransformInfo::TargetCostKind CostKind)
TargetTransformInfo::OperandValueInfo getOperandInfo(VPValue *V) const
Returns the OperandInfo for V, if it is a live-in.
bool skipCostComputation(Instruction *UI, bool IsVector) const
Return true if the cost for UI shouldn't be computed, e.g.
InstructionCost getLegacyCost(Instruction *UI, ElementCount VF) const
Return the cost for UI with VF using the legacy cost model as fallback until computing the cost of al...
TargetTransformInfo::TargetCostKind CostKind
const TargetLibraryInfo & TLI
const TargetTransformInfo & TTI
SmallPtrSet< Instruction *, 8 > SkipCostComputation