|
LLVM 23.0.0git
|
This file contains implementations for different VPlan recipes. More...
#include "LoopVectorizationPlanner.h"#include "VPlan.h"#include "VPlanAnalysis.h"#include "VPlanHelpers.h"#include "VPlanPatternMatch.h"#include "VPlanUtils.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/IVDescriptors.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/ScalarEvolutionExpressions.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/Type.h"#include "llvm/IR/Value.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/LoopUtils.h"#include <cassert>Go to the source code of this file.
Namespaces | |
| namespace | llvm |
| This is an optimization pass for GlobalISel generic memory operations. | |
Macros | |
| #define | LV_NAME "loop-vectorize" |
| #define | DEBUG_TYPE LV_NAME |
Typedefs | |
| using | VectorParts = SmallVector<Value *, 2> |
Functions | |
| static InstructionCost | getCostForIntrinsics (Intrinsic::ID ID, ArrayRef< const VPValue * > Operands, const VPRecipeWithIRFlags &R, ElementCount VF, VPCostContext &Ctx) |
Compute the cost for the intrinsic ID with Operands, produced by R. | |
| static void | scalarizeInstruction (const Instruction *Instr, VPReplicateRecipe *RepRecipe, const VPLane &Lane, VPTransformState &State) |
| A helper function to scalarize a single Instruction in the innermost loop. | |
| static const SCEV * | getAddressAccessSCEV (const VPValue *Ptr, PredicatedScalarEvolution &PSE, const Loop *L) |
Returns a SCEV expression for Ptr if it is a pointer computation for which the legacy cost model computes a SCEV expression when computing the address cost. | |
| static bool | isUsedByLoadStoreAddress (const VPUser *V) |
Returns true if V is used as part of the address of another load or store. | |
| static bool | isPredicatedUniformMemOpAfterTailFolding (const VPReplicateRecipe &R, const SCEV *PtrSCEV, VPCostContext &Ctx) |
Return true if R is a predicated load/store with a loop-invariant address only masked by the header mask. | |
| static Instruction * | createReverseEVL (IRBuilderBase &Builder, Value *Operand, Value *EVL, const Twine &Name) |
| Use all-true mask for reverse rather than actual mask, as it avoids a dependence w/o affecting the result. | |
| static Value * | createBitOrPointerCast (IRBuilderBase &Builder, Value *V, VectorType *DstVTy, const DataLayout &DL) |
| static Value * | interleaveVectors (IRBuilderBase &Builder, ArrayRef< Value * > Vals, const Twine &Name) |
| Return a vector containing interleaved elements from multiple smaller input vectors. | |
This file contains implementations for different VPlan recipes.
Definition in file VPlanRecipes.cpp.
| #define DEBUG_TYPE LV_NAME |
Definition at line 48 of file VPlanRecipes.cpp.
| #define LV_NAME "loop-vectorize" |
Definition at line 47 of file VPlanRecipes.cpp.
| using VectorParts = SmallVector<Value *, 2> |
Definition at line 45 of file VPlanRecipes.cpp.
|
static |
Definition at line 4044 of file VPlanRecipes.cpp.
References assert(), llvm::cast(), DL, llvm::VectorType::get(), llvm::Type::getIntNTy(), llvm::CastInst::isBitOrNoopPointerCastable(), llvm::Type::isFloatingPointTy(), and llvm::Type::isPointerTy().
Referenced by llvm::VPInterleaveEVLRecipe::execute(), and llvm::VPInterleaveRecipe::execute().
|
static |
Use all-true mask for reverse rather than actual mask, as it avoids a dependence w/o affecting the result.
Definition at line 3881 of file VPlanRecipes.cpp.
References llvm::cast(), and llvm::Value::getType().
Referenced by llvm::VPWidenLoadEVLRecipe::execute(), and llvm::VPWidenStoreEVLRecipe::execute().
|
static |
Returns a SCEV expression for Ptr if it is a pointer computation for which the legacy cost model computes a SCEV expression when computing the address cost.
Computing SCEVs for VPValues is incomplete and returns SCEVCouldNotCompute in cases the legacy cost model can compute SCEVs. In those cases we fall back to the legacy cost model. Otherwise return nullptr.
Definition at line 3345 of file VPlanRecipes.cpp.
References llvm::vputils::getSCEVExprForVPValue(), llvm::PredicatedScalarEvolution::getSE(), llvm::isa(), and llvm::vputils::isAddressSCEVForCost().
|
static |
Compute the cost for the intrinsic ID with Operands, produced by R.
Definition at line 1926 of file VPlanRecipes.cpp.
References Arguments, llvm::dyn_cast_or_null(), llvm::enumerate(), llvm::InstructionCost::getInvalid(), llvm::ElementCount::isVector(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::toVectorizedTy(), and llvm::toVectorTy().
Referenced by llvm::VPReplicateRecipe::computeCost(), and llvm::VPWidenIntrinsicRecipe::computeCost().
|
static |
Return a vector containing interleaved elements from multiple smaller input vectors.
Definition at line 4076 of file VPlanRecipes.cpp.
References assert(), llvm::cast(), llvm::concatenateVectors(), llvm::createInterleaveMask(), getType(), and llvm::ArrayRef< T >::size().
Referenced by llvm::VPInterleaveEVLRecipe::execute(), and llvm::VPInterleaveRecipe::execute().
|
static |
Return true if R is a predicated load/store with a loop-invariant address only masked by the header mask.
Definition at line 3407 of file VPlanRecipes.cpp.
References llvm::cast(), llvm::VPBasicBlock::front(), llvm::VPBlockBase::getEntryBasicBlock(), llvm::VPBlockBase::getPlan(), llvm::vputils::isHeaderMask(), and llvm::VPRegionBlock::isReplicator().
Referenced by llvm::VPReplicateRecipe::computeCost().
Returns true if V is used as part of the address of another load or store.
Definition at line 3357 of file VPlanRecipes.cpp.
References llvm::append_range(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::none_of(), llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::seq().
Referenced by llvm::VPReplicateRecipe::computeCost().
|
static |
A helper function to scalarize a single Instruction in the innermost loop.
Generates a sequence of scalar instances for lane Lane. Uses the VPValue operands from RepRecipe instead of Instr's operands.
Definition at line 3247 of file VPlanRecipes.cpp.
References llvm::all_of(), llvm::VPIRFlags::applyFlags(), llvm::VPIRMetadata::applyMetadata(), assert(), llvm::canVectorizeTy(), llvm::cast(), DL, llvm::dyn_cast(), llvm::enumerate(), llvm::VPRecipeBase::getDebugLoc(), llvm::VPLane::getFirstLane(), llvm::VPRecipeBase::getParent(), llvm::VPBlockBase::getPlan(), llvm::VPIRFlags::getPredicate(), llvm::VPRecipeBase::getRegion(), llvm::Value::getType(), llvm::VPlan::getVectorLoopRegion(), llvm::VPIRFlags::hasPredicate(), I, II, llvm::vputils::isSingleScalar(), llvm::Value::mutateType(), llvm::VPUser::operands(), llvm::Value::setName(), and llvm::User::setOperand().
Referenced by llvm::VPReplicateRecipe::execute().