|
LLVM
10.0.0
|
LoopVectorizationCostModel - estimates the expected speedups due to vectorization. More...
Classes | |
| struct | RegisterUsage |
| A struct that represents some properties of the register usage of a loop. More... | |
Public Types | |
| enum | InstWidening { CM_Unknown, CM_Widen, CM_Widen_Reverse, CM_Interleave, CM_GatherScatter, CM_Scalarize } |
| Decision that was taken during cost calculation for memory instruction. More... | |
Public Member Functions | |
| LoopVectorizationCostModel (ScalarEpilogueLowering SEL, Loop *L, PredicatedScalarEvolution &PSE, LoopInfo *LI, LoopVectorizationLegality *Legal, const TargetTransformInfo &TTI, const TargetLibraryInfo *TLI, DemandedBits *DB, AssumptionCache *AC, OptimizationRemarkEmitter *ORE, const Function *F, const LoopVectorizeHints *Hints, InterleavedAccessInfo &IAI) | |
| Optional< unsigned > | computeMaxVF () |
| bool | runtimeChecksRequired () |
| VectorizationFactor | selectVectorizationFactor (unsigned MaxVF) |
| void | selectUserVectorizationFactor (unsigned UserVF) |
| Setup cost-based decisions for user vectorization factor. More... | |
| std::pair< unsigned, unsigned > | getSmallestAndWidestTypes () |
| unsigned | selectInterleaveCount (unsigned VF, unsigned LoopCost) |
| void | setCostBasedWideningDecision (unsigned VF) |
| Memory access instruction may be vectorized in more than one way. More... | |
| SmallVector< RegisterUsage, 8 > | calculateRegisterUsage (ArrayRef< unsigned > VFs) |
| void | collectValuesToIgnore () |
| Collect values we want to ignore in the cost model. More... | |
| const MapVector< Instruction *, uint64_t > & | getMinimalBitwidths () const |
| bool | isProfitableToScalarize (Instruction *I, unsigned VF) const |
| bool | isUniformAfterVectorization (Instruction *I, unsigned VF) const |
Returns true if I is known to be uniform after vectorization. More... | |
| bool | isScalarAfterVectorization (Instruction *I, unsigned VF) const |
Returns true if I is known to be scalar after vectorization. More... | |
| bool | canTruncateToMinimalBitwidth (Instruction *I, unsigned VF) const |
| void | setWideningDecision (Instruction *I, unsigned VF, InstWidening W, unsigned Cost) |
Save vectorization decision W and Cost taken by the cost model for instruction I and vector width VF. More... | |
| void | setWideningDecision (const InterleaveGroup< Instruction > *Grp, unsigned VF, InstWidening W, unsigned Cost) |
Save vectorization decision W and Cost taken by the cost model for interleaving group Grp and vector width VF. More... | |
| InstWidening | getWideningDecision (Instruction *I, unsigned VF) |
Return the cost model decision for the given instruction I and vector width VF. More... | |
| unsigned | getWideningCost (Instruction *I, unsigned VF) |
Return the vectorization cost for the given instruction I and vector width VF. More... | |
| bool | isOptimizableIVTruncate (Instruction *I, unsigned VF) |
Return True if instruction I is an optimizable truncate whose operand is an induction variable. More... | |
| void | collectInstsToScalarize (unsigned VF) |
| Collects the instructions to scalarize for each predicated instruction in the loop. More... | |
| void | collectUniformsAndScalars (unsigned VF) |
Collect Uniform and Scalar values for the given VF. More... | |
| bool | isLegalMaskedStore (Type *DataType, Value *Ptr, MaybeAlign Alignment) |
Returns true if the target machine supports masked store operation for the given DataType and kind of access to Ptr. More... | |
| bool | isLegalMaskedLoad (Type *DataType, Value *Ptr, MaybeAlign Alignment) |
Returns true if the target machine supports masked load operation for the given DataType and kind of access to Ptr. More... | |
| bool | isLegalMaskedScatter (Type *DataType, MaybeAlign Alignment) |
Returns true if the target machine supports masked scatter operation for the given DataType. More... | |
| bool | isLegalMaskedGather (Type *DataType, MaybeAlign Alignment) |
Returns true if the target machine supports masked gather operation for the given DataType. More... | |
| bool | isLegalGatherOrScatter (Value *V) |
Returns true if the target machine can represent V as a masked gather or scatter operation. More... | |
| bool | isScalarWithPredication (Instruction *I, unsigned VF=1) |
Returns true if I is an instruction that will be scalarized with predication. More... | |
| bool | isPredicatedInst (Instruction *I) |
| bool | memoryInstructionCanBeWidened (Instruction *I, unsigned VF=1) |
Returns true if I is a memory instruction with consecutive memory access that can be widened. More... | |
| bool | interleavedAccessCanBeWidened (Instruction *I, unsigned VF=1) |
Returns true if I is a memory instruction in an interleaved-group of memory accesses that can be vectorized with wide vector loads/stores and shuffles. More... | |
| bool | isAccessInterleaved (Instruction *Instr) |
Check if Instr belongs to any interleaved access group. More... | |
| const InterleaveGroup< Instruction > * | getInterleavedAccessGroup (Instruction *Instr) |
Get the interleaved access group that Instr belongs to. More... | |
| bool | requiresScalarEpilogue () const |
| Returns true if an interleaved group requires a scalar iteration to handle accesses with gaps, and there is nothing preventing us from creating a scalar epilogue. More... | |
| bool | isScalarEpilogueAllowed () const |
| Returns true if a scalar epilogue is not allowed due to optsize or a loop hint annotation. More... | |
| bool | foldTailByMasking () const |
| Returns true if all loop blocks should be masked to fold tail loop. More... | |
| bool | blockNeedsPredication (BasicBlock *BB) |
| unsigned | getVectorIntrinsicCost (CallInst *CI, unsigned VF) |
| Estimate cost of an intrinsic call instruction CI if it were vectorized with factor VF. More... | |
| unsigned | getVectorCallCost (CallInst *CI, unsigned VF, bool &NeedToScalarize) |
| Estimate cost of a call instruction CI if it were vectorized with factor VF. More... | |
Public Attributes | |
| Loop * | TheLoop |
| The loop that we evaluate. More... | |
| PredicatedScalarEvolution & | PSE |
| Predicated scalar evolution analysis. More... | |
| LoopInfo * | LI |
| Loop Info analysis. More... | |
| LoopVectorizationLegality * | Legal |
| Vectorization legality. More... | |
| const TargetTransformInfo & | TTI |
| Vector target information. More... | |
| const TargetLibraryInfo * | TLI |
| Target Library Info. More... | |
| DemandedBits * | DB |
| Demanded bits analysis. More... | |
| AssumptionCache * | AC |
| Assumption cache. More... | |
| OptimizationRemarkEmitter * | ORE |
| Interface to emit optimization remarks. More... | |
| const Function * | TheFunction |
| const LoopVectorizeHints * | Hints |
| Loop Vectorize Hint. More... | |
| InterleavedAccessInfo & | InterleaveInfo |
| The interleave access information contains groups of interleaved accesses with the same stride and close to each other. More... | |
| SmallPtrSet< const Value *, 16 > | ValuesToIgnore |
| Values to ignore in the cost model. More... | |
| SmallPtrSet< const Value *, 16 > | VecValuesToIgnore |
| Values to ignore in the cost model when VF > 1. More... | |
LoopVectorizationCostModel - estimates the expected speedups due to vectorization.
In many cases vectorization is not profitable. This can happen because of a number of reasons. In this class we mainly attempt to predict the expected speedup/slowdowns due to the supported instruction set. We use the TargetTransformInfo to query the different backends for the cost of different operations.
Definition at line 960 of file LoopVectorize.cpp.
Decision that was taken during cost calculation for memory instruction.
| Enumerator | |
|---|---|
| CM_Unknown | |
| CM_Widen | |
| CM_Widen_Reverse | |
| CM_Interleave | |
| CM_GatherScatter | |
| CM_Scalarize | |
Definition at line 1097 of file LoopVectorize.cpp.
|
inline |
Definition at line 962 of file LoopVectorize.cpp.
|
inline |
Definition at line 1296 of file LoopVectorize.cpp.
References llvm::LoopVectorizationLegality::blockNeedsPredication(), llvm::CM_ScalarEpilogueAllowed, llvm::dyn_cast(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::InnerLoopVectorizer::Legal, and llvm::make_filter_range().
| SmallVector< LoopVectorizationCostModel::RegisterUsage, 8 > LoopVectorizationCostModel::calculateRegisterUsage | ( | ArrayRef< unsigned > | VFs | ) |
Definition at line 5359 of file LoopVectorize.cpp.
References assert(), llvm::LoopBlocksDFS::beginRPO(), llvm::dbgs(), DFS(), llvm::dyn_cast(), llvm::numbers::e, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::end(), llvm::SmallPtrSetImpl< PtrType >::end(), llvm::LoopBlocksDFS::endRPO(), llvm::SmallPtrSetImpl< PtrType >::erase(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::find(), llvm::SmallPtrSetImpl< PtrType >::find(), llvm::find(), llvm::LoopVectorizationLegality::getMaxSafeDepDistBytes(), llvm::TargetTransformInfo::getRegisterBitWidth(), llvm::TargetTransformInfo::getRegisterClassForType(), llvm::TargetTransformInfo::getRegisterClassName(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::InnerLoopVectorizer::Legal, llvm::InnerLoopVectorizer::LI, List, LLVM_DEBUG, llvm::LoopVectorizationCostModel::RegisterUsage::LoopInvariantRegs, llvm::make_range(), llvm::max(), llvm::LoopVectorizationCostModel::RegisterUsage::MaxLocalUsers, NumberOfStoresToPredicate, llvm::LoopBlocksDFS::perform(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::RegUsage, llvm::SmallVectorBase::size(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::size(), llvm::SmallPtrSetImplBase::size(), llvm::ArrayRef< T >::size(), llvm::InnerLoopVectorizer::TTI, and llvm::InnerLoopVectorizer::VF.
|
inline |
I can be truncated to a smaller bitwidth for vectorization factor VF. Definition at line 1090 of file LoopVectorize.cpp.
| void LoopVectorizationCostModel::collectInstsToScalarize | ( | unsigned | VF | ) |
Collects the instructions to scalarize for each predicated instruction in the loop.
Definition at line 5572 of file LoopVectorize.cpp.
References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::begin(), C, llvm::InnerLoopVectorizer::Cost, llvm::dbgs(), llvm::SmallVectorBase::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), ForceTargetInstructionCost, llvm::TargetTransformInfo::getCFInstrCost(), llvm::Instruction::getParent(), getReciprocalPredBlockProb(), llvm::TargetTransformInfo::getScalarizationOverhead(), llvm::Value::getType(), llvm::Value::hasOneUse(), I, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::VectorType::isValidElementType(), llvm::Type::isVoidTy(), LLVM_DEBUG, llvm::User::operands(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), ToVectorTy(), llvm::InnerLoopVectorizer::TTI, and llvm::InnerLoopVectorizer::VF.
|
inline |
Collect Uniform and Scalar values for the given VF.
The sets depend on CM decision for Load/Store instructions that may be vectorized as interleave, gather-scatter or scalarized.
Definition at line 1192 of file LoopVectorize.cpp.
| void LoopVectorizationCostModel::collectValuesToIgnore | ( | ) |
Collect values we want to ignore in the cost model.
Definition at line 6421 of file LoopVectorize.cpp.
References llvm::InnerLoopVectorizer::AC, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::CodeMetrics::collectEphemeralValues(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallPtrSetImpl< PtrType >::end(), llvm::RecurrenceDescriptor::getCastInsts(), llvm::InductionDescriptor::getCastInsts(), llvm::LoopVectorizationLegality::getInductionVars(), llvm::LoopVectorizationLegality::getReductionVars(), llvm::InnerLoopVectorizer::Induction, llvm::InnerLoopVectorizer::Legal, and Reduction.
Referenced by llvm::LoopVectorizePass::processLoop().
Definition at line 4917 of file LoopVectorize.cpp.
References assert(), llvm::CM_ScalarEpilogueAllowed, llvm::CM_ScalarEpilogueNotAllowedLowTripLoop, llvm::CM_ScalarEpilogueNotAllowedOptSize, llvm::CM_ScalarEpilogueNotNeededUsePredicate, llvm::computeMinimumValueSizes(), llvm::dbgs(), llvm::LoopVectorizationLegality::getMaxSafeRegisterWidth(), llvm::TargetTransformInfo::getMinimumVF(), llvm::TargetTransformInfo::getNumberOfRegisters(), llvm::TargetTransformInfo::getRegisterBitWidth(), llvm::LoopVectorizationLegality::getRuntimePointerChecking(), llvm::PredicatedScalarEvolution::getSE(), llvm::ScalarEvolution::getSmallConstantTripCount(), llvm::TargetTransformInfo::hasBranchDivergence(), llvm::isPowerOf2_32(), llvm::InnerLoopVectorizer::Legal, LLVM_DEBUG, MaximizeBandwidth, llvm::RuntimePointerChecking::Need, llvm::None, llvm::InnerLoopVectorizer::ORE, llvm::LoopVectorizationLegality::prepareToFoldTailByMasking(), llvm::InnerLoopVectorizer::PSE, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::reportVectorizationFailure(), llvm::TargetTransformInfo::shouldMaximizeVectorBandwidth(), llvm::InnerLoopVectorizer::TTI, useMaskedInterleavedAccesses(), and llvm::AArch64CC::VS.
|
inline |
Returns true if all loop blocks should be masked to fold tail loop.
Definition at line 1294 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::fixReduction(), and llvm::InnerLoopVectorizer::getOrCreateVectorTripCount().
|
inline |
Get the interleaved access group that Instr belongs to.
Definition at line 1276 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopVectorizer::vectorizeInterleaveGroup().
|
inline |
Definition at line 1036 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopVectorizer::truncateToMinimalBitwidths().
Definition at line 5131 of file LoopVectorize.cpp.
References llvm::RecurrenceDescriptor::getRecurrenceType(), llvm::LoopVectorizationLegality::getReductionVars(), llvm::Type::getScalarType(), llvm::DataLayout::getTypeSizeInBits(), I, llvm::Type::isPointerTy(), llvm::LoopVectorizationLegality::isReductionVariable(), llvm::InnerLoopVectorizer::Legal, llvm::max(), and llvm::ARM_MB::ST.
Referenced by determineVPlanVF().
| unsigned LoopVectorizationCostModel::getVectorCallCost | ( | CallInst * | CI, |
| unsigned | VF, | ||
| bool & | NeedToScalarize | ||
| ) |
Estimate cost of a call instruction CI if it were vectorized with factor VF.
Return the cost of the instruction, including scalarization overhead if it's needed. The flag NeedToScalarize shows if the call needs to be scalarized - i.e. either vector version isn't available, or is too expensive.
Definition at line 3257 of file LoopVectorize.cpp.
References llvm::CallBase::arg_operands(), llvm::InnerLoopVectorizer::Cost, F(), llvm::CallBase::getCalledFunction(), llvm::TargetTransformInfo::getCallInstrCost(), llvm::Value::getName(), llvm::Value::getType(), llvm::TargetLibraryInfo::isFunctionVectorizable(), llvm::CallBase::isNoBuiltin(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::InnerLoopVectorizer::TLI, ToVectorTy(), and llvm::InnerLoopVectorizer::TTI.
Estimate cost of an intrinsic call instruction CI if it were vectorized with factor VF.
Return the cost of the instruction, including scalarization overhead if it's needed.
Definition at line 3301 of file LoopVectorize.cpp.
References llvm::CallBase::arg_operands(), assert(), llvm::TargetTransformInfo::getIntrinsicInstrCost(), llvm::Value::getType(), llvm::getVectorIntrinsicIDForCall(), Operands, llvm::InnerLoopVectorizer::TLI, llvm::InnerLoopVectorizer::TTI, and llvm::InnerLoopVectorizer::VF.
|
inline |
Return the vectorization cost for the given instruction I and vector width VF.
Definition at line 1151 of file LoopVectorize.cpp.
References assert().
|
inline |
Return the cost model decision for the given instruction I and vector width VF.
Return CM_Unknown if this instruction did not pass through the cost modeling.
Definition at line 1134 of file LoopVectorize.cpp.
References assert(), and EnableVPlanNativePath.
Referenced by llvm::InnerLoopVectorizer::vectorizeMemoryInstruction().
| bool LoopVectorizationCostModel::interleavedAccessCanBeWidened | ( | Instruction * | I, |
| unsigned | VF = 1 |
||
| ) |
Returns true if I is a memory instruction in an interleaved-group of memory accesses that can be vectorized with wide vector loads/stores and shuffles.
Definition at line 4636 of file LoopVectorize.cpp.
References assert(), llvm::LoopVectorizationLegality::blockNeedsPredication(), llvm::Module::getDataLayout(), llvm::getLoadStoreAlignment(), getMemInstValueType(), llvm::Instruction::getModule(), llvm::Instruction::getParent(), hasIrregularType(), I, llvm::TargetTransformInfo::isLegalMaskedLoad(), llvm::TargetTransformInfo::isLegalMaskedStore(), llvm::LoopVectorizationLegality::isMaskRequired(), llvm::InnerLoopVectorizer::Legal, llvm::InnerLoopVectorizer::TTI, and useMaskedInterleavedAccesses().
|
inline |
Check if Instr belongs to any interleaved access group.
Definition at line 1270 of file LoopVectorize.cpp.
Returns true if the target machine can represent V as a masked gather or scatter operation.
Definition at line 1229 of file LoopVectorize.cpp.
References llvm::getLoadStoreAlignment(), getMemInstValueType(), I, llvm::InnerLoopVectorizer::LI, and SI.
|
inline |
Returns true if the target machine supports masked gather operation for the given DataType.
Definition at line 1223 of file LoopVectorize.cpp.
References llvm::TargetTransformInfo::isLegalMaskedGather(), and llvm::InnerLoopVectorizer::TTI.
|
inline |
Returns true if the target machine supports masked load operation for the given DataType and kind of access to Ptr.
Definition at line 1210 of file LoopVectorize.cpp.
References llvm::LoopVectorizationLegality::isConsecutivePtr(), llvm::TargetTransformInfo::isLegalMaskedLoad(), llvm::InnerLoopVectorizer::Legal, and llvm::InnerLoopVectorizer::TTI.
|
inline |
Returns true if the target machine supports masked scatter operation for the given DataType.
Definition at line 1217 of file LoopVectorize.cpp.
References llvm::TargetTransformInfo::isLegalMaskedScatter(), and llvm::InnerLoopVectorizer::TTI.
|
inline |
Returns true if the target machine supports masked store operation for the given DataType and kind of access to Ptr.
Definition at line 1203 of file LoopVectorize.cpp.
References llvm::LoopVectorizationLegality::isConsecutivePtr(), llvm::TargetTransformInfo::isLegalMaskedStore(), llvm::InnerLoopVectorizer::Legal, and llvm::InnerLoopVectorizer::TTI.
|
inline |
Return True if instruction I is an optimizable truncate whose operand is an induction variable.
Such a truncate will be removed by adding a new induction variable with the destination type.
Definition at line 1162 of file LoopVectorize.cpp.
References llvm::dyn_cast(), llvm::LoopVectorizationLegality::getPrimaryInduction(), I, llvm::LoopVectorizationLegality::isInductionPhi(), llvm::TargetTransformInfo::isTruncateFree(), llvm::InnerLoopVectorizer::Legal, ToVectorTy(), and llvm::InnerLoopVectorizer::TTI.
|
inline |
Definition at line 1250 of file LoopVectorize.cpp.
References llvm::Instruction::getParent(), I, llvm::LoopVectorizationLegality::isMaskRequired(), and llvm::InnerLoopVectorizer::Legal.
|
inline |
I for vectorization factor VF. Definition at line 1042 of file LoopVectorize.cpp.
References assert(), and EnableVPlanNativePath.
Referenced by llvm::InnerLoopVectorizer::shouldScalarizeInstruction().
|
inline |
Returns true if I is known to be scalar after vectorization.
Definition at line 1073 of file LoopVectorize.cpp.
References assert(), and EnableVPlanNativePath.
Referenced by llvm::InnerLoopVectorizer::shouldScalarizeInstruction().
|
inline |
Returns true if a scalar epilogue is not allowed due to optsize or a loop hint annotation.
Definition at line 1289 of file LoopVectorize.cpp.
References llvm::CM_ScalarEpilogueAllowed.
Referenced by llvm::InnerLoopVectorizer::vectorizeInterleaveGroup().
| bool LoopVectorizationCostModel::isScalarWithPredication | ( | Instruction * | I, |
| unsigned | VF = 1 |
||
| ) |
Returns true if I is an instruction that will be scalarized with predication.
Such instructions include conditional stores and instructions that may divide by zero. If a non-zero VF has been calculated, we check if I will be scalarized predication for that VF.
Definition at line 4601 of file LoopVectorize.cpp.
References assert(), llvm::getLoadStoreAlignment(), llvm::getLoadStorePointerOperand(), getMemInstValueType(), llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), I, llvm::LoopVectorizationLegality::isMaskRequired(), llvm::InnerLoopVectorizer::Legal, llvm::SPII::Load, mayDivideByZero(), and llvm::SPII::Store.
|
inline |
Returns true if I is known to be uniform after vectorization.
Definition at line 1057 of file LoopVectorize.cpp.
References assert(), and EnableVPlanNativePath.
Referenced by llvm::InnerLoopVectorizer::buildScalarSteps(), llvm::InnerLoopVectorizer::fixLCSSAPHIs(), llvm::InnerLoopVectorizer::getOrCreateScalarValue(), llvm::InnerLoopVectorizer::getOrCreateVectorValue(), and llvm::InnerLoopVectorizer::widenPHIInstruction().
| bool LoopVectorizationCostModel::memoryInstructionCanBeWidened | ( | Instruction * | I, |
| unsigned | VF = 1 |
||
| ) |
Returns true if I is a memory instruction with consecutive memory access that can be widened.
Definition at line 4673 of file LoopVectorize.cpp.
References llvm::all_of(), assert(), llvm::SetVector< T, Vector, Set >::begin(), llvm::SetVector< T, Vector, Set >::count(), llvm::dbgs(), llvm::dyn_cast(), llvm::SetVector< T, Vector, Set >::end(), llvm::SmallPtrSetImpl< PtrType >::end(), llvm::SmallPtrSetImpl< PtrType >::find(), llvm::Module::getDataLayout(), llvm::LoopVectorizationLegality::getInductionVars(), llvm::getLoadStorePointerOperand(), llvm::Instruction::getModule(), llvm::User::getOperand(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), hasIrregularType(), I, llvm::InnerLoopVectorizer::Induction, llvm::SetVector< T, Vector, Set >::insert(), llvm::SetVector< T, SmallVector< T, N >, SmallDenseSet< T, N > >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::LoopVectorizationLegality::isConsecutivePtr(), llvm::LoopVectorizationLegality::isFirstOrderRecurrence(), llvm::InnerLoopVectorizer::Legal, llvm::InnerLoopVectorizer::LI, LLVM_DEBUG, OP, llvm::User::operand_values(), SI, llvm::SetVector< T, Vector, Set >::size(), and llvm::InnerLoopVectorizer::VF.
|
inline |
Returns true if an interleaved group requires a scalar iteration to handle accesses with gaps, and there is nothing preventing us from creating a scalar epilogue.
Definition at line 1283 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), and llvm::InnerLoopVectorizer::getOrCreateVectorTripCount().
| bool LoopVectorizationCostModel::runtimeChecksRequired | ( | ) |
Definition at line 4883 of file LoopVectorize.cpp.
References llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::LoopVectorizationLegality::getLAI(), llvm::SCEVUnionPredicate::getPredicates(), llvm::LoopVectorizationLegality::getRuntimePointerChecking(), llvm::LoopAccessInfo::getSymbolicStrides(), llvm::PredicatedScalarEvolution::getUnionPredicate(), llvm::InnerLoopVectorizer::Legal, LLVM_DEBUG, llvm::RuntimePointerChecking::Need, llvm::InnerLoopVectorizer::ORE, llvm::InnerLoopVectorizer::PSE, and llvm::reportVectorizationFailure().
Definition at line 5186 of file LoopVectorize.cpp.
References assert(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::TargetTransformInfo::enableAggressiveInterleaving(), EnableIndVarRegisterHeur, EnableLoadStoreRuntimeInterleave, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::end(), F(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::find(), ForceTargetMaxScalarInterleaveFactor, ForceTargetMaxVectorInterleaveFactor, ForceTargetNumScalarRegs, ForceTargetNumVectorRegs, llvm::TargetTransformInfo::getMaxInterleaveFactor(), llvm::LoopVectorizationLegality::getMaxSafeDepDistBytes(), llvm::TargetTransformInfo::getNumberOfRegisters(), llvm::LoopVectorizationLegality::getNumLoads(), llvm::LoopVectorizationLegality::getNumStores(), llvm::LoopVectorizationLegality::getReductionVars(), llvm::TargetTransformInfo::getRegisterClassName(), llvm::LoopVectorizationLegality::getRuntimePointerChecking(), llvm::PredicatedScalarEvolution::getSE(), getSmallBestKnownTC(), llvm::InnerLoopVectorizer::Legal, LLVM_DEBUG, llvm::LoopVectorizationCostModel::RegisterUsage::LoopInvariantRegs, llvm::max(), llvm::LoopVectorizationCostModel::RegisterUsage::MaxLocalUsers, MaxNestedScalarReductionIC, llvm::RuntimePointerChecking::Need, llvm::PowerOf2Floor(), llvm::InnerLoopVectorizer::PSE, SmallLoopCost, TinyTripCountInterleaveThreshold, and llvm::InnerLoopVectorizer::TTI.
Referenced by llvm::LoopVectorizePass::processLoop().
|
inline |
Setup cost-based decisions for user vectorization factor.
Definition at line 990 of file LoopVectorize.cpp.
References llvm::InnerLoopVectorizer::VF.
| VectorizationFactor LoopVectorizationCostModel::selectVectorizationFactor | ( | unsigned | MaxVF | ) |
Definition at line 5080 of file LoopVectorize.cpp.
References C, llvm::InnerLoopVectorizer::Cost, llvm::dbgs(), EnableCondStoresVectorization, llvm::LoopVectorizeHints::FK_Enabled, LLVM_DEBUG, llvm::max(), llvm::InnerLoopVectorizer::ORE, and llvm::reportVectorizationFailure().
| void LoopVectorizationCostModel::setCostBasedWideningDecision | ( | unsigned | VF | ) |
Memory access instruction may be vectorized in more than one way.
Form of instruction after vectorization depends on cost. This function takes cost-based decisions for Load/Store instructions and collects them in a map. This decisions map is used for building the lists of loop-uniform and loop-scalar instructions. The calculated cost is saved with widening decision in order to avoid redundant calculations.
Definition at line 6000 of file LoopVectorize.cpp.
References llvm::MCID::Add, assert(), llvm::LoopVectorizationLegality::blockNeedsPredication(), llvm::MCID::Call, llvm::InnerLoopVectorizer::Cost, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::TargetTransformInfo::getArithmeticInstrCost(), llvm::TargetTransformInfo::getCastInstrCost(), llvm::TargetTransformInfo::getCFInstrCost(), llvm::TargetTransformInfo::getCmpSelInstrCost(), llvm::SelectInst::getCondition(), llvm::Type::getContext(), llvm::Type::getInt1Ty(), llvm::getLoadStorePointerOperand(), getMemInstValueType(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::TargetTransformInfo::getOperandInfo(), llvm::Instruction::getParent(), getReciprocalPredBlockProb(), llvm::TargetTransformInfo::getScalarizationOverhead(), llvm::PredicatedScalarEvolution::getSE(), llvm::TargetTransformInfo::getShuffleCost(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::getVectorIntrinsicIDForCall(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::BranchInst::isConditional(), llvm::LoopVectorizationLegality::isConsecutivePtr(), llvm::LoopVectorizationLegality::isFirstOrderRecurrence(), isStrideMul(), llvm::LoopVectorizationLegality::isUniform(), llvm::Type::isVectorTy(), largestIntegerVectorType(), llvm::InnerLoopVectorizer::Legal, LLVM_FALLTHROUGH, llvm::SPII::Load, llvm::max(), N, llvm::TargetTransformInfo::OK_AnyValue, llvm::TargetTransformInfo::OK_UniformValue, llvm::TargetTransformInfo::OP_None, llvm::User::operand_values(), Operands, llvm::User::operands(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::TargetTransformInfo::prefersVectorizedAddressing(), llvm::InnerLoopVectorizer::PSE, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::MCID::Select, SI, llvm::TargetTransformInfo::SK_ExtractSubvector, smallestIntegerVectorType(), llvm::SPII::Store, llvm::InnerLoopVectorizer::TLI, ToVectorTy(), llvm::InnerLoopVectorizer::TTI, and llvm::InnerLoopVectorizer::VF.
|
inline |
Save vectorization decision W and Cost taken by the cost model for instruction I and vector width VF.
Definition at line 1108 of file LoopVectorize.cpp.
References assert().
|
inline |
Save vectorization decision W and Cost taken by the cost model for interleaving group Grp and vector width VF.
Broadcast this decicion to all instructions inside the group. But the cost will be assigned to one instruction only.
Definition at line 1116 of file LoopVectorize.cpp.
References assert(), llvm::InterleaveGroup< InstTy >::getFactor(), llvm::InterleaveGroup< InstTy >::getInsertPos(), llvm::InterleaveGroup< InstTy >::getMember(), and I.
| AssumptionCache* llvm::LoopVectorizationCostModel::AC |
Assumption cache.
Definition at line 1500 of file LoopVectorize.cpp.
| DemandedBits* llvm::LoopVectorizationCostModel::DB |
Demanded bits analysis.
Definition at line 1497 of file LoopVectorize.cpp.
| const LoopVectorizeHints* llvm::LoopVectorizationCostModel::Hints |
Loop Vectorize Hint.
Definition at line 1508 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopVectorizer::emitMemRuntimeChecks().
| InterleavedAccessInfo& llvm::LoopVectorizationCostModel::InterleaveInfo |
The interleave access information contains groups of interleaved accesses with the same stride and close to each other.
Definition at line 1512 of file LoopVectorize.cpp.
| LoopVectorizationLegality* llvm::LoopVectorizationCostModel::Legal |
Vectorization legality.
Definition at line 1488 of file LoopVectorize.cpp.
| LoopInfo* llvm::LoopVectorizationCostModel::LI |
Loop Info analysis.
Definition at line 1485 of file LoopVectorize.cpp.
| OptimizationRemarkEmitter* llvm::LoopVectorizationCostModel::ORE |
Interface to emit optimization remarks.
Definition at line 1503 of file LoopVectorize.cpp.
| PredicatedScalarEvolution& llvm::LoopVectorizationCostModel::PSE |
Predicated scalar evolution analysis.
Definition at line 1482 of file LoopVectorize.cpp.
Definition at line 1505 of file LoopVectorize.cpp.
| Loop* llvm::LoopVectorizationCostModel::TheLoop |
The loop that we evaluate.
Definition at line 1479 of file LoopVectorize.cpp.
| const TargetLibraryInfo* llvm::LoopVectorizationCostModel::TLI |
Target Library Info.
Definition at line 1494 of file LoopVectorize.cpp.
| const TargetTransformInfo& llvm::LoopVectorizationCostModel::TTI |
Vector target information.
Definition at line 1491 of file LoopVectorize.cpp.
| SmallPtrSet<const Value *, 16> llvm::LoopVectorizationCostModel::ValuesToIgnore |
Values to ignore in the cost model.
Definition at line 1515 of file LoopVectorize.cpp.
| SmallPtrSet<const Value *, 16> llvm::LoopVectorizationCostModel::VecValuesToIgnore |
Values to ignore in the cost model when VF > 1.
Definition at line 1518 of file LoopVectorize.cpp.
1.8.13