LLVM  6.0.0svn
Classes | Public Member Functions | Protected Member Functions | List of all members
llvm::LoopVectorizationPlanner Class Reference

InnerLoopVectorizer vectorizes loops which contain only one basic LoopVectorizationPlanner - drives the vectorization process after having passed Legality checks. More...

Classes

struct  VFRange
 A range of powers-of-2 vectorization factors with fixed start and adjustable end. More...
 

Public Member Functions

 LoopVectorizationPlanner (Loop *L, LoopInfo *LI, const TargetLibraryInfo *TLI, const TargetTransformInfo *TTI, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM)
 
 ~LoopVectorizationPlanner ()
 
LoopVectorizationCostModel::VectorizationFactor plan (bool OptForSize, unsigned UserVF)
 Plan how to best vectorize, return the best VF and its cost. More...
 
void setBestPlan (unsigned VF, unsigned UF)
 Finalize the best decision and dispose of all other VPlans. More...
 
void executePlan (InnerLoopVectorizer &LB, DominatorTree *DT)
 Generate the IR code for the body of the vectorized loop according to the best selected VPlan. More...
 
void printPlans (raw_ostream &O)
 

Protected Member Functions

void collectTriviallyDeadInstructions (SmallPtrSetImpl< Instruction *> &DeadInstructions)
 Collect the instructions from the original loop that would be trivially dead in the vectorized loop if generated. More...
 
bool getDecisionAndClampRange (const std::function< bool(unsigned)> &Predicate, VFRange &Range)
 Test a Predicate on a Range of VF's. More...
 
void buildVPlans (unsigned MinVF, unsigned MaxVF)
 Build VPlans for power-of-2 VF's between MinVF and MaxVF inclusive, according to the information gathered by Legal when it checked if it is legal to vectorize the loop. More...
 

Detailed Description

InnerLoopVectorizer vectorizes loops which contain only one basic LoopVectorizationPlanner - drives the vectorization process after having passed Legality checks.

The planner builds and optimizes the Vectorization Plans which record the decisions how to vectorize the given loop. In particular, represent the control-flow of the vectorized version, the replication of instructions that are to be scalarized, and interleave access groups.

Definition at line 2211 of file LoopVectorize.cpp.

Constructor & Destructor Documentation

◆ LoopVectorizationPlanner()

llvm::LoopVectorizationPlanner::LoopVectorizationPlanner ( Loop L,
LoopInfo LI,
const TargetLibraryInfo TLI,
const TargetTransformInfo TTI,
LoopVectorizationLegality *  Legal,
LoopVectorizationCostModel &  CM 
)
inline

Definition at line 2236 of file LoopVectorize.cpp.

◆ ~LoopVectorizationPlanner()

llvm::LoopVectorizationPlanner::~LoopVectorizationPlanner ( )
inline

Member Function Documentation

◆ buildVPlans()

void LoopVectorizationPlanner::buildVPlans ( unsigned  MinVF,
unsigned  MaxVF 
)
protected

Build VPlans for power-of-2 VF's between MinVF and MaxVF inclusive, according to the information gathered by Legal when it checked if it is legal to vectorize the loop.

Build VPlans for the full range of feasible VF's = {MinVF, 2 * MinVF, 4 * MinVF, ..., MaxVF} by repeatedly building a VPlan for a sub-range of VF's starting at a given VF and extending it as much as possible.

Each vectorization decision can potentially shorten this sub-range during buildVPlan().

Definition at line 8008 of file LoopVectorize.cpp.

References llvm::MCID::Add, llvm::PHINode::addIncoming(), llvm::VPlan::addVF(), llvm::VPBasicBlock::appendRecipe(), assert(), llvm::VPBasicBlock::back(), llvm::LoopBlocksDFS::beginRPO(), llvm::VPTransformState::Builder, llvm::MCID::Call, llvm::VPTransformState::CFG, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::BranchInst::Create(), llvm::InnerLoopVectorizer::createBlockInMask(), llvm::IRBuilder< T, Inserter >::CreateExtractElement(), llvm::IRBuilder< T, Inserter >::CreatePHI(), llvm::dbgs(), DEBUG, DFS(), llvm::VPBlockBase::disconnectSuccessor(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::VPBasicBlock::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::LoopVectorizationPlanner::VFRange::End, llvm::LoopBlocksDFS::endRPO(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::raw_ostream::flush(), function, llvm::VectorType::get(), llvm::UndefValue::get(), llvm::VPlan::getEntry(), llvm::IRBuilderBase::getInt32(), llvm::InductionDescriptor::getKind(), llvm::Value::getName(), llvm::Instruction::getOpcode(), llvm::Instruction::getOpcodeName(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::VectorizerValueMap::getScalarValue(), llvm::BasicBlock::getSinglePredecessor(), llvm::VPBlockBase::getSingleSuccessor(), llvm::VPBlockBase::getSuccessors(), llvm::BasicBlock::getTerminator(), llvm::IRBuilderBase::getTrue(), llvm::Value::getType(), llvm::InsertElementInst::getType(), getVectorCallCost(), getVectorIntrinsicCost(), llvm::getVectorIntrinsicIDForCall(), llvm::VectorizerValueMap::getVectorValue(), llvm::VectorizerValueMap::hasVectorValue(), I, llvm::InductionDescriptor::IK_FpInduction, llvm::InductionDescriptor::IK_IntInduction, llvm::VPTransformState::ILV, llvm::VPTransformState::Instance, llvm::Type::isVectorTy(), llvm::Type::isVoidTy(), llvm::InnerLoopVectorizer::Legal, llvm::InnerLoopVectorizer::LI, llvm::SPII::Load, llvm::make_range(), llvm::RISCVFenceField::O, llvm::User::operands(), llvm::InnerLoopVectorizer::OrigLoop, llvm::InnerLoopVectorizer::packScalarIntoVectorValue(), llvm::LoopBlocksDFS::perform(), llvm::VPTransformState::CFGState::PrevBB, llvm::ReplaceInstWithInst(), llvm::VectorizerValueMap::resetScalarValue(), llvm::VectorizerValueMap::resetVectorValue(), llvm::InnerLoopVectorizer::scalarizeInstruction(), llvm::MCID::Select, llvm::VPlan::setEntry(), llvm::VPBlockBase::setName(), llvm::VPlan::setName(), llvm::VPBlockBase::setOneSuccessor(), llvm::VectorizerValueMap::setVectorValue(), llvm::LoopVectorizationPlanner::VFRange::Start, llvm::SPII::Store, llvm::InnerLoopVectorizer::TLI, llvm::InnerLoopVectorizer::TTI, llvm::VPTransformState::UF, llvm::RegState::Undef, llvm::VPTransformState::ValueMap, llvm::VPTransformState::VF, and llvm::InnerLoopVectorizer::VF.

◆ collectTriviallyDeadInstructions()

void LoopVectorizationPlanner::collectTriviallyDeadInstructions ( SmallPtrSetImpl< Instruction *> &  DeadInstructions)
protected

◆ executePlan()

void LoopVectorizationPlanner::executePlan ( InnerLoopVectorizer LB,
DominatorTree DT 
)

◆ getDecisionAndClampRange()

bool LoopVectorizationPlanner::getDecisionAndClampRange ( const std::function< bool(unsigned)> &  Predicate,
VFRange Range 
)
protected

Test a Predicate on a Range of VF's.

Return the value of applying Predicate on Range.Start, possibly decreasing Range.End such that the returned value holds for the entire Range.

Definition at line 7989 of file LoopVectorize.cpp.

References assert(), llvm::LoopVectorizationPlanner::VFRange::End, and llvm::LoopVectorizationPlanner::VFRange::Start.

◆ plan()

LoopVectorizationCostModel::VectorizationFactor LoopVectorizationPlanner::plan ( bool  OptForSize,
unsigned  UserVF 
)

Plan how to best vectorize, return the best VF and its cost.

Definition at line 7572 of file LoopVectorize.cpp.

References assert(), llvm::dbgs(), DEBUG, llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), llvm::isPowerOf2_32(), and VectorizationFactor.

Referenced by llvm::LoopVectorizePass::processLoop().

◆ printPlans()

void llvm::LoopVectorizationPlanner::printPlans ( raw_ostream O)
inline

Definition at line 2261 of file LoopVectorize.cpp.

◆ setBestPlan()

void LoopVectorizationPlanner::setBestPlan ( unsigned  VF,
unsigned  UF 
)

Finalize the best decision and dispose of all other VPlans.

Definition at line 7613 of file LoopVectorize.cpp.

References assert(), llvm::dbgs(), DEBUG, llvm::VPlan::hasVF(), llvm::InnerLoopVectorizer::UF, and llvm::InnerLoopVectorizer::VF.

Referenced by llvm::LoopVectorizePass::processLoop().


The documentation for this class was generated from the following file: