|
LLVM
10.0.0
|
Bottom Up SLP Vectorizer. More...
Classes | |
| struct | EdgeInfo |
| This structure holds any data we need about the edges being traversed during buildTree_rec(). More... | |
| class | VLOperands |
| A helper data structure to hold the operands of a vector of instructions. More... | |
Public Types | |
| using | ValueList = SmallVector< Value *, 8 > |
| using | InstrList = SmallVector< Instruction *, 16 > |
| using | ValueSet = SmallPtrSet< Value *, 16 > |
| using | StoreList = SmallVector< StoreInst *, 8 > |
| using | ExtraValueToDebugLocsMap = MapVector< Value *, SmallVector< Instruction *, 2 > > |
Public Member Functions | |
| BoUpSLP (Function *Func, ScalarEvolution *Se, TargetTransformInfo *Tti, TargetLibraryInfo *TLi, AliasAnalysis *Aa, LoopInfo *Li, DominatorTree *Dt, AssumptionCache *AC, DemandedBits *DB, const DataLayout *DL, OptimizationRemarkEmitter *ORE) | |
| Value * | vectorizeTree () |
Vectorize the tree that starts with the elements in VL. More... | |
| Value * | vectorizeTree (ExtraValueToDebugLocsMap &ExternallyUsedValues) |
Vectorize the tree but with the list of externally used values ExternallyUsedValues. More... | |
| int | getSpillCost () const |
| int | getTreeCost () |
| void | buildTree (ArrayRef< Value *> Roots, ArrayRef< Value *> UserIgnoreLst=None) |
Construct a vectorizable tree that starts at Roots, ignoring users for the purpose of scheduling and extraction in the UserIgnoreLst. More... | |
| void | buildTree (ArrayRef< Value *> Roots, ExtraValueToDebugLocsMap &ExternallyUsedValues, ArrayRef< Value *> UserIgnoreLst=None) |
Construct a vectorizable tree that starts at Roots, ignoring users for the purpose of scheduling and extraction in the UserIgnoreLst taking into account (and updating it, if required) list of externally used values stored in ExternallyUsedValues. More... | |
| void | deleteTree () |
| Clear the internal data structures that are created by 'buildTree'. More... | |
| unsigned | getTreeSize () const |
| void | optimizeGatherSequence () |
| Perform LICM and CSE on the newly generated gather sequences. More... | |
| Optional< ArrayRef< unsigned > > | bestOrder () const |
| unsigned | getVectorElementSize (Value *V) const |
| void | computeMinimumValueSizes () |
| Compute the minimum type sizes required to represent the entries in a vectorizable tree. More... | |
| unsigned | getMaxVecRegSize () const |
| unsigned | getMinVecRegSize () const |
| unsigned | canMapToVector (Type *T, const DataLayout &DL) const |
| Check if homogeneous aggregate is isomorphic to some VectorType. More... | |
| bool | isTreeTinyAndNotFullyVectorizable () const |
| bool | isLoadCombineReductionCandidate (unsigned ReductionOpcode) const |
| Assume that a legal-sized 'or'-reduction of shifted/zexted loaded values can be load combined in the backend. More... | |
| OptimizationRemarkEmitter * | getORE () |
| bool | isDeleted (Instruction *I) const |
| Checks if the instruction is marked for deletion. More... | |
| void | eraseInstructions (ArrayRef< Value *> AV) |
| Marks values operands for later deletion by replacing them with Undefs. More... | |
| ~BoUpSLP () | |
Friends | |
| struct | GraphTraits< BoUpSLP *> |
| struct | DOTGraphTraits< BoUpSLP *> |
| raw_ostream & | operator<< (raw_ostream &os, const BoUpSLP::ScheduleData &SD) |
Bottom Up SLP Vectorizer.
Definition at line 526 of file SLPVectorizer.cpp.
| using llvm::slpvectorizer::BoUpSLP::ExtraValueToDebugLocsMap = MapVector<Value *, SmallVector<Instruction *, 2> > |
Definition at line 536 of file SLPVectorizer.cpp.
| using llvm::slpvectorizer::BoUpSLP::InstrList = SmallVector<Instruction *, 16> |
Definition at line 532 of file SLPVectorizer.cpp.
| using llvm::slpvectorizer::BoUpSLP::StoreList = SmallVector<StoreInst *, 8> |
Definition at line 534 of file SLPVectorizer.cpp.
| using llvm::slpvectorizer::BoUpSLP::ValueList = SmallVector<Value *, 8> |
Definition at line 531 of file SLPVectorizer.cpp.
| using llvm::slpvectorizer::BoUpSLP::ValueSet = SmallPtrSet<Value *, 16> |
Definition at line 533 of file SLPVectorizer.cpp.
|
inline |
Definition at line 538 of file SLPVectorizer.cpp.
References llvm::CodeMetrics::collectEphemeralValues(), F(), MaxVectorRegSizeOption, MinVectorRegSizeOption, and None.
| BoUpSLP::~BoUpSLP | ( | ) |
Definition at line 2326 of file SLPVectorizer.cpp.
References assert(), llvm::UndefValue::get(), llvm::Value::replaceAllUsesWith(), and llvm::RegState::Undef.
Definition at line 613 of file SLPVectorizer.cpp.
References llvm::computeMinimumValueSizes(), I, llvm::makeArrayRef(), and None.
| void llvm::slpvectorizer::BoUpSLP::buildTree | ( | ArrayRef< Value *> | Roots, |
| ArrayRef< Value *> | UserIgnoreLst = None |
||
| ) |
Construct a vectorizable tree that starts at Roots, ignoring users for the purpose of scheduling and extraction in the UserIgnoreLst.
| void llvm::slpvectorizer::BoUpSLP::buildTree | ( | ArrayRef< Value *> | Roots, |
| ExtraValueToDebugLocsMap & | ExternallyUsedValues, | ||
| ArrayRef< Value *> | UserIgnoreLst = None |
||
| ) |
Construct a vectorizable tree that starts at Roots, ignoring users for the purpose of scheduling and extraction in the UserIgnoreLst taking into account (and updating it, if required) list of externally used values stored in ExternallyUsedValues.
| unsigned BoUpSLP::canMapToVector | ( | Type * | T, |
| const DataLayout & | DL | ||
| ) | const |
Check if homogeneous aggregate is isomorphic to some VectorType.
Accepts homogeneous multidimensional aggregate of scalars/vectors like {[4 x i16], [4 x i16]}, { <2 x float>, <2 x float> }, {{{i16, i16}, {i16, i16}}, {{i16, i16}, {i16, i16}}} and so on.
Definition at line 3115 of file SLPVectorizer.cpp.
References llvm::MCID::Add, llvm::all_of(), allConstant(), allSameBlock(), allSameType(), llvm::CallBase::arg_operands(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::SmallVectorImpl< T >::assign(), llvm::MCID::Call, llvm::SmallVectorImpl< T >::clear(), llvm::dbgs(), llvm::dyn_cast(), llvm::numbers::e, E, llvm::MipsISD::Ext, F(), llvm::IntegerType::get(), llvm::VectorType::get(), getAlignment(), llvm::CallBase::getArgOperand(), llvm::Module::getDataLayout(), getExtractIndex(), llvm::Type::getInt1Ty(), llvm::Instruction::getModule(), llvm::CallBase::getNumArgOperands(), llvm::SequentialType::getNumElements(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), getSameOpcode(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSizeInBits(), llvm::Optional< T >::getValue(), llvm::getVectorIntrinsicIDForCall(), llvm::Value::hasNUses(), llvm::Value::hasOneUse(), llvm::Optional< T >::hasValue(), I, llvm::Instruction::isBinaryOp(), llvm::Instruction::isCast(), isShuffle(), llvm::LoadInst::isSimple(), isSplat(), isValidElementType(), LLVM_DEBUG, llvm_unreachable, llvm::SPII::Load, N, llvm::TargetTransformInfo::OK_AnyValue, llvm::TargetTransformInfo::OK_NonUniformConstantValue, llvm::TargetTransformInfo::OK_UniformConstantValue, op, llvm::TargetTransformInfo::OP_None, llvm::TargetTransformInfo::OP_PowerOf2, Operands, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::MCID::Select, SI, llvm::ArrayRef< T >::size(), llvm::TargetTransformInfo::SK_Broadcast, llvm::TargetTransformInfo::SK_PermuteSingleSrc, llvm::TargetTransformInfo::SK_Select, llvm::ARM_MB::ST, llvm::SPII::Store, llvm::T, llvm::TargetTransformInfo::TCK_RecipThroughput, llvm::Instruction::user_back(), llvm::Value::user_begin(), llvm::Value::user_end(), and llvm::Value::users().
| void BoUpSLP::computeMinimumValueSizes | ( | ) |
Compute the minimum type sizes required to represent the entries in a vectorizable tree.
Definition at line 5399 of file SLPVectorizer.cpp.
References llvm::AnalysisUsage::addPreserved(), llvm::AnalysisUsage::addRequired(), llvm::all_of(), assert(), collectValuesToDemote(), llvm::computeKnownBits(), llvm::ComputeNumSignBits(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), F(), llvm::Pass::getAnalysisUsage(), llvm::PassRegistry::getPassRegistry(), llvm::DataLayout::getTypeSizeInBits(), llvm::Value::hasOneUse(), llvm::initializeSLPVectorizerPass(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::KnownBits::isNonNegative(), llvm::isPowerOf2_64(), llvm::BitmaskEnumDetail::Mask(), llvm::NextPowerOf2(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SLPVectorizerPass::runImpl(), runOnFunction(), llvm::NVPTX::PTXLdStInstCode::Scalar, llvm::AnalysisUsage::setPreservesCFG(), and llvm::Value::user_back().
|
inline |
Clear the internal data structures that are created by 'buildTree'.
Definition at line 593 of file SLPVectorizer.cpp.
Marks values operands for later deletion by replacing them with Undefs.
Definition at line 2343 of file SLPVectorizer.cpp.
References llvm::MCID::Add, allConstant(), allSameBlock(), allSameType(), assert(), llvm::SmallVectorImpl< T >::assign(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::MCID::Call, llvm::SmallVectorImpl< T >::clear(), llvm::dbgs(), llvm::Depth, llvm::dyn_cast(), llvm::numbers::e, E, llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::end(), llvm::lltok::equal, eraseInstruction(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::find(), llvm::find(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::CallBase::getArgOperand(), llvm::CallBase::getBundleOperandsEndIndex(), llvm::CallBase::getBundleOperandsStartIndex(), llvm::CallBase::getCalledFunction(), llvm::CallBase::getNumArgOperands(), llvm::User::getOperand(), llvm::BasicBlock::getParent(), llvm::PPC::getPredicate(), llvm::CmpInst::getPredicate(), getSameOpcode(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::getVectorIntrinsicIDForCall(), llvm::CallBase::hasIdenticalOperandBundleSchema(), llvm::CallBase::hasOperandBundles(), llvm::hasVectorInstrinsicScalarOpd(), I, Int, InTreeUserNeedToExtract(), llvm::is_contained(), isCommutative(), llvm::isPowerOf2_32(), isSplat(), llvm::Instruction::isTerminator(), llvm::isTriviallyVectorizable(), isValidElementType(), llvm::AArch64CC::LE, llvm::Left, LLVM_DEBUG, llvm::SPII::Load, None, llvm::User::op_begin(), Operands, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), RecursionMaxDepth, llvm::Right, llvm::NVPTX::PTXLdStInstCode::Scalar, llvm::MCID::Select, SI, Size, llvm::SmallVectorBase::size(), llvm::sortPtrAccesses(), llvm::SPII::Store, std::swap(), llvm::TE, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace(), and llvm::Value::users().
|
inline |
Definition at line 639 of file SLPVectorizer.cpp.
|
inline |
Definition at line 644 of file SLPVectorizer.cpp.
|
inline |
Definition at line 669 of file SLPVectorizer.cpp.
| int BoUpSLP::getSpillCost | ( | ) | const |
Definition at line 3671 of file SLPVectorizer.cpp.
References llvm::dbgs(), llvm::Value::dump(), llvm::dyn_cast(), llvm::SmallPtrSetImpl< PtrType >::erase(), llvm::VectorType::get(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getParent(), llvm::ilist_iterator< OptionsT, IsReverse, IsConst >::getReverse(), llvm::SmallPtrSetImpl< PtrType >::insert(), LLVM_DEBUG, llvm::User::operands(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::BasicBlock::rbegin(), llvm::BasicBlock::rend(), llvm::SmallPtrSetImplBase::size(), and X.
| int BoUpSLP::getTreeCost | ( | ) |
VL. A negative number means that this is profitable. Definition at line 3740 of file SLPVectorizer.cpp.
References llvm::all_of(), llvm::any_of(), assert(), C, llvm::SmallVectorImpl< T >::clear(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dbgs(), llvm::numbers::e, E, llvm::SmallVectorImpl< T >::emplace_back(), llvm::SmallVectorBase::empty(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::ArrayRef< T >::empty(), F(), llvm::find(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::UndefValue::get(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::SequentialType::getNumElements(), llvm::Instruction::getParent(), getSameOpcode(), llvm::Value::getType(), llvm::slpvectorizer::BoUpSLP::VLOperands::getVL(), I, llvm::SmallSet< T, N, C >::insert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isPowerOf2_32(), llvm::AArch64CC::LE, llvm::Left, LLVM_DEBUG, llvm::make_range(), llvm::RISCVFenceField::R, llvm::slpvectorizer::BoUpSLP::VLOperands::reorder(), llvm::Right, SI, llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::TargetTransformInfo::SK_PermuteSingleSrc, llvm::TE, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace(), ViewGraph(), and ViewSLPTree.
|
inline |
Definition at line 607 of file SLPVectorizer.cpp.
V. If V is a store, the size is the width of the stored value. Otherwise, the size is the width of the largest loaded value reaching V. This method is used by the vectorizer to calculate vectorization factors. Definition at line 5269 of file SLPVectorizer.cpp.
References llvm::SmallPtrSetImpl< PtrType >::count(), llvm::SmallVectorBase::empty(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::User::operands(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), and llvm::SPII::Store.
|
inline |
Checks if the instruction is marked for deletion.
Definition at line 1369 of file SLPVectorizer.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::dbgs(), llvm::Depth, llvm::dump(), llvm::dyn_cast(), llvm::numbers::e, E, llvm::SmallVectorBase::empty(), llvm::ArrayRef< T >::empty(), llvm::empty(), llvm::ArrayRef< T >::end(), llvm::lltok::equal, eraseInstruction(), llvm::ArrayRef< T >::front(), getLocation(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), getOpcode(), llvm::User::getOperand(), getSameOpcode(), llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), I, llvm::raw_ostream::indent(), llvm::cl::init(), isOneOf(), isSimple(), llvm::Left, LLVM_DUMP_METHOD, llvm::None, Operands, llvm::MemoryLocation::Ptr, llvm::SmallVectorImpl< T >::resize(), llvm::Right, llvm::NVPTX::PTXLdStInstCode::Scalar, llvm::SmallVectorBase::size(), llvm::ArrayRef< T >::size(), llvm::size(), llvm::TE, and llvm::slpvectorizer::BoUpSLP::EdgeInfo::UserTE.
Assume that a legal-sized 'or'-reduction of shifted/zexted loaded values can be load combined in the backend.
Load combining may not be allowed in the IR optimizer, so we do not want to alter the pattern. For example, partially transforming a scalar bswap() pattern into vector code is effectively impossible for the backend to undo. TODO: If load combining is allowed in the IR optimizer, this analysis may not be necessary.
Definition at line 3614 of file SLPVectorizer.cpp.
References Context, llvm::dbgs(), llvm::IntegerType::get(), llvm::Value::getContext(), llvm::Type::getIntegerBitWidth(), llvm::Type::getPointerElementType(), llvm::Value::getType(), LLVM_DEBUG, llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Load(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), and llvm::PatternMatch::match().
| bool BoUpSLP::isTreeTinyAndNotFullyVectorizable | ( | ) | const |
Definition at line 3651 of file SLPVectorizer.cpp.
References assert(), and MinTreeSize.
| void BoUpSLP::optimizeGatherSequence | ( | ) |
Perform LICM and CSE on the newly generated gather sequences.
Definition at line 4737 of file SLPVectorizer.cpp.
References A, assert(), B, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::BasicBlock::begin(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::dbgs(), llvm::dyn_cast(), llvm::numbers::e, E, llvm::SmallVectorTemplateCommon< T >::end(), llvm::BasicBlock::end(), eraseInstruction(), llvm::ilist_node_impl< OptionsT >::getIterator(), getLocation(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::ilist_iterator< OptionsT, IsReverse, IsConst >::getReverse(), llvm::BasicBlock::getTerminator(), I, llvm::tgtok::In, llvm::is_contained(), llvm::Instruction::isIdenticalTo(), isOneOf(), LLVM_DEBUG, llvm::Instruction::mayReadOrWriteMemory(), llvm::Instruction::moveBefore(), N, None, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::SmallVectorImpl< T >::reserve(), and llvm::stable_sort().
| Value * BoUpSLP::vectorizeTree | ( | ) |
Vectorize the tree that starts with the elements in VL.
Returns the vectorized root.
Definition at line 4580 of file SLPVectorizer.cpp.
| Value * BoUpSLP::vectorizeTree | ( | ExtraValueToDebugLocsMap & | ExternallyUsedValues | ) |
Vectorize the tree but with the list of externally used values ExternallyUsedValues.
Values in this MapVector can be replaced but the generated extractvalue instructions.
Definition at line 4586 of file SLPVectorizer.cpp.
References assert(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::count(), llvm::dbgs(), llvm::numbers::e, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::erase(), eraseInstruction(), F(), llvm::IntegerType::get(), llvm::VectorType::get(), getParent(), llvm::Value::getType(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::insert(), llvm::is_contained(), llvm::Type::isVoidTy(), llvm::AArch64CC::LE, LLVM_DEBUG, llvm::Value::replaceAllUsesWith(), llvm::User::replaceUsesOfWith(), llvm::NVPTX::PTXLdStInstCode::Scalar, second, llvm::User::User(), and llvm::Value::users().
|
friend |
Definition at line 1931 of file SLPVectorizer.cpp.
|
friend |
Definition at line 1930 of file SLPVectorizer.cpp.
|
friend |
Definition at line 1923 of file SLPVectorizer.cpp.
1.8.13