|
LLVM 22.0.0git
|
This file implements transforms for initial VPlan construction. More...
#include "LoopVectorizationPlanner.h"#include "VPlan.h"#include "VPlanCFG.h"#include "VPlanDominatorTree.h"#include "VPlanPatternMatch.h"#include "VPlanTransforms.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/LoopIterator.h"#include "llvm/Analysis/ScalarEvolution.h"#include "llvm/Analysis/ScalarEvolutionExpressions.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/MDBuilder.h"#include "llvm/Transforms/Utils/LoopUtils.h"#include "llvm/Transforms/Utils/LoopVersioning.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "vplan" |
Functions | |
| static bool | isHeaderBB (BasicBlock *BB, Loop *L) |
| static bool | canonicalHeaderAndLatch (VPBlockBase *HeaderVPB, const VPDominatorTree &VPDT) |
Checks if HeaderVPB is a loop header block in the plain CFG; that is, it has exactly 2 predecessors (preheader and latch), where the block dominates the latch and the preheader dominates the block. | |
| static void | createLoopRegion (VPlan &Plan, VPBlockBase *HeaderVPB) |
Create a new VPRegionBlock for the loop starting at HeaderVPB. | |
| static void | addCanonicalIVRecipes (VPlan &Plan, VPBasicBlock *HeaderVPBB, VPBasicBlock *LatchVPBB, Type *IdxTy, DebugLoc DL) |
| static void | createExtractsForLiveOuts (VPlan &Plan, VPBasicBlock *MiddleVPBB) |
Creates extracts for values in Plan defined in a loop region and used outside a loop region. | |
| static void | addInitialSkeleton (VPlan &Plan, Type *InductionTy, DebugLoc IVDL, PredicatedScalarEvolution &PSE, Loop *TheLoop) |
| static void | simplifyLiveInsWithSCEV (VPlan &Plan, ScalarEvolution &SE) |
Check Plan's live-in and replace them with constants, if they can be simplified via SCEV. | |
| static VPHeaderPHIRecipe * | createWidenInductionRecipe (PHINode *Phi, VPPhi *PhiR, VPValue *Start, const InductionDescriptor &IndDesc, VPlan &Plan, ScalarEvolution &SE, Loop &OrigLoop, DebugLoc DL) |
Creates a VPWidenIntOrFpInductionRecipe or VPWidenPointerInductionRecipe for Phi based on IndDesc. | |
| template<typename MatchT> | |
| static VPRecipeBase * | findUserOf (VPValue *V, const MatchT &P) |
If V is used by a recipe matching pattern P, return it. | |
| template<unsigned Opcode> | |
| static VPInstruction * | findUserOf (VPValue *V) |
If V is used by a VPInstruction with Opcode, return it. | |
Variables | |
| static constexpr uint32_t | CheckBypassWeights [] = {1, 127} |
This file implements transforms for initial VPlan construction.
Definition in file VPlanConstruction.cpp.
| #define DEBUG_TYPE "vplan" |
Definition at line 29 of file VPlanConstruction.cpp.
|
static |
Definition at line 452 of file VPlanConstruction.cpp.
References llvm::VPBasicBlock::back(), llvm::VPBasicBlock::begin(), llvm::VPInstruction::BranchOnCount, DL, llvm::VPBasicBlock::empty(), llvm::VPRecipeBase::eraseFromParent(), llvm::VPRecipeBase::getDebugLoc(), llvm::VPlan::getOrAddLiveIn(), llvm::VPBasicBlock::getTerminator(), llvm::VPlan::getVectorTripCount(), llvm::VPlan::getVFxUF(), llvm::VPBasicBlock::insert(), llvm::VPlanPatternMatch::m_BranchOnCond(), and llvm::PatternMatch::match().
Referenced by addInitialSkeleton().
|
static |
Definition at line 509 of file VPlanConstruction.cpp.
References addCanonicalIVRecipes(), llvm::VPUser::addOperand(), assert(), canonicalHeaderAndLatch(), llvm::cast(), llvm::VPBlockUtils::connectBlocks(), createExtractsForLiveOuts(), llvm::VPBuilder::createScalarPhi(), llvm::VPlan::createVPBasicBlock(), llvm::drop_begin(), llvm::VPlan::getEntry(), llvm::vputils::getOrCreateVPValueForSCEVExpr(), llvm::VPlan::getScalarHeader(), llvm::PredicatedScalarEvolution::getSE(), llvm::VPBlockBase::getSingleSuccessor(), llvm::VPBlockBase::getSuccessors(), llvm::PredicatedScalarEvolution::getSymbolicMaxBackedgeTakenCount(), llvm::ScalarEvolution::getTripCountFromExitCount(), llvm::VPBlockUtils::insertBlockAfter(), llvm::VPBlockUtils::insertOnEdge(), llvm::isa(), llvm::VPBasicBlock::phis(), llvm::VPlan::setTripCount(), llvm::VPBlockBase::swapSuccessors(), and llvm::zip_equal().
Referenced by llvm::VPlanTransforms::buildVPlan0().
|
static |
Checks if HeaderVPB is a loop header block in the plain CFG; that is, it has exactly 2 predecessors (preheader and latch), where the block dominates the latch and the preheader dominates the block.
If it is a header block return true and canonicalize the predecessors of the header (making sure the preheader appears first and the latch second) and the successors of the latch (making sure the loop exit comes first). Otherwise return false.
Definition at line 378 of file VPlanConstruction.cpp.
References assert(), llvm::VPInstruction::BranchOnCond, llvm::cast(), llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates(), getOpcode(), llvm::VPBlockBase::getPredecessors(), llvm::VPInstruction::Not, llvm::ArrayRef< T >::size(), std::swap(), and llvm::VPBlockBase::swapPredecessors().
Referenced by addInitialSkeleton(), and llvm::VPlanTransforms::createLoopRegions().
|
static |
Creates extracts for values in Plan defined in a loop region and used outside a loop region.
Definition at line 487 of file VPlanConstruction.cpp.
References assert(), B(), llvm::cast(), llvm::VPlan::getExitBlocks(), and llvm::VPBasicBlock::getFirstNonPhi().
Referenced by addInitialSkeleton().
|
static |
Create a new VPRegionBlock for the loop starting at HeaderVPB.
Definition at line 425 of file VPlanConstruction.cpp.
References assert(), llvm::VPBlockUtils::connectBlocks(), llvm::VPlan::createLoopRegion(), llvm::VPBlockUtils::disconnectBlocks(), llvm::VPBlockBase::getPredecessors(), llvm::VPBlockBase::getSingleSuccessor(), llvm::VPBlockUtils::insertOnEdge(), llvm::VPBlockBase::setParent(), and llvm::vp_depth_first_shallow().
Referenced by llvm::VPlanTransforms::createLoopRegions().
|
static |
Creates a VPWidenIntOrFpInductionRecipe or VPWidenPointerInductionRecipe for Phi based on IndDesc.
Definition at line 600 of file VPlanConstruction.cpp.
References assert(), DL, llvm::VPValue::getDefiningRecipe(), llvm::vputils::getFlagsFromIndDesc(), llvm::InductionDescriptor::getKind(), llvm::VPlan::getLiveIn(), llvm::VPUser::getOperand(), llvm::vputils::getOrCreateVPValueForSCEVExpr(), llvm::ScalarEvolution::getSCEV(), llvm::vputils::getSCEVExprForVPValue(), llvm::InductionDescriptor::getStartValue(), llvm::InductionDescriptor::getStep(), llvm::Value::getType(), llvm::VPlan::getVF(), llvm::VPlan::getVFxUF(), llvm::InductionDescriptor::IK_FpInduction, llvm::InductionDescriptor::IK_IntInduction, llvm::InductionDescriptor::IK_PtrInduction, llvm::ScalarEvolution::isLoopInvariant(), llvm::ScalarEvolution::isSCEVable(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_Specific(), llvm::VPlanPatternMatch::m_VPValue(), llvm::PatternMatch::match(), and llvm::VPUser::setOperand().
Referenced by llvm::VPlanTransforms::createHeaderPhiRecipes().
|
static |
If V is used by a VPInstruction with Opcode, return it.
Otherwise return nullptr.
Definition at line 964 of file VPlanConstruction.cpp.
References llvm::cast_or_null(), findUserOf(), and llvm::VPlanPatternMatch::m_VPInstruction().
|
static |
If V is used by a recipe matching pattern P, return it.
Otherwise return nullptr;
Definition at line 957 of file VPlanConstruction.cpp.
References llvm::cast(), llvm::find_if(), llvm::PatternMatch::match_fn(), and P.
Referenced by findUserOf(), llvm::VPlanTransforms::handleMaxMinNumReductions(), and llvm::VPlanTransforms::handleMultiUseReductions().
|
static |
Definition at line 92 of file VPlanConstruction.cpp.
|
static |
Check Plan's live-in and replace them with constants, if they can be simplified via SCEV.
Definition at line 572 of file VPlanConstruction.cpp.
References llvm::CallingConv::C, llvm::dyn_cast(), llvm::VPlan::getLiveIns(), llvm::VPlan::getOrAddLiveIn(), and llvm::vputils::getSCEVExprForVPValue().
Referenced by llvm::VPlanTransforms::buildVPlan0().
|
staticconstexpr |
Definition at line 796 of file VPlanConstruction.cpp.
Referenced by llvm::VPlanTransforms::attachCheckBlock().