|
LLVM 24.0.0git
|
This file contains implementations for different VPlan recipes. More...
#include "LoopVectorizationPlanner.h"#include "VPlan.h"#include "VPlanHelpers.h"#include "VPlanPatternMatch.h"#include "VPlanUtils.h"#include "VectorizeOptions.h"#include "llvm/ADT/APFloat.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/SmallVectorExtras.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/BlockFrequencyInfoImpl.h"#include "llvm/Analysis/IVDescriptors.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/ScalarEvolutionExpressions.h"#include "llvm/IR/AttributeMask.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/ProfDataUtils.h"#include "llvm/IR/Type.h"#include "llvm/IR/Value.h"#include "llvm/Support/Casting.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.
Macros | |
| #define | LV_NAME "loop-vectorize" |
| #define | DEBUG_TYPE LV_NAME |
Functions | |
| static unsigned | getCalledFnOperandIndex (ArrayRef< VPValue * > Operands) |
| For call VPInstruction operands, return the operand index of the called function. | |
| static Function * | getCalledFunction (ArrayRef< VPValue * > Operands) |
| For call VPInstruction operands, return the called function. | |
| static AttributeSet | getCalleeFnAttrs (const VPInstruction &VPI) |
Return the function attributes of the callee of VPI, which must be a call or intrinsic VPInstruction. | |
| static SmallVector< unsigned > | getExtractValueIndices (ArrayRef< VPValue * > Ops) |
| static Instruction::BinaryOps | getSubRecurOpcode (RecurKind Kind) |
| static void | executePhiRecipe (VPSingleDefRecipe *R, VPPhiAccessors &Phi, VPTransformState &State, bool IsScalar, const Twine &Name) |
| Shared execute logic for VPPhi and VPWidenPHIRecipe. | |
| static VPExecutionFrequency | getExecutionFrequencyFromMD (const MDNode *Node) |
Returns the execution frequency recorded in Node. | |
| static void | printRecurrenceKind (raw_ostream &OS, const RecurKind &Kind) |
| static const ConstantFP * | getConstantFP (const VPValue *V) |
Returns the ConstantFP V wraps, or nullptr if it does not wrap one. | |
| 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 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 50 of file VPlanRecipes.cpp.
| #define LV_NAME "loop-vectorize" |
Definition at line 49 of file VPlanRecipes.cpp.
|
static |
Definition at line 4707 of file VPlanRecipes.cpp.
References assert(), llvm::cast(), DL, llvm::VectorType::get(), llvm::Type::getIntNTy(), llvm::CastInst::isBitOrNoopPointerCastable(), llvm::Type::isFloatingPointTy(), llvm::Type::isPointerTy(), and V.
Referenced by llvm::VPInterleaveEVLRecipe::execute(), and llvm::VPInterleaveRecipe::execute().
|
static |
Shared execute logic for VPPhi and VPWidenPHIRecipe.
Creates a PHI node, adds incoming values, and stores the result in State. For header phis, only the preheader incoming value is added; the backedge is fixed up later by VPlan::execute().
Definition at line 2049 of file VPlanRecipes.cpp.
References llvm::PHINode::addIncoming(), llvm::Value::getType(), and llvm::VPBlockUtils::isHeader().
Referenced by llvm::VPPhi::execute(), and llvm::VPWidenPHIRecipe::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 4172 of file VPlanRecipes.cpp.
References llvm::vputils::getSCEVExprForVPValue(), llvm::PredicatedScalarEvolution::getSE(), llvm::isa(), and llvm::vputils::isAddressSCEVForCost().
For call VPInstruction operands, return the operand index of the called function.
The function is either the last operand (for unmasked calls) or the second-to-last operand (for masked calls).
Definition at line 55 of file VPlanRecipes.cpp.
References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), llvm::cast(), llvm::dyn_cast(), getValue(), llvm::isa(), and Operands.
Referenced by getCalledFunction(), llvm::VPInstruction::getNumOperandsForOpcode(), llvm::VPInstruction::printRecipe(), and llvm::VPIRAttributes::VPIRAttributes().
For call VPInstruction operands, return the called function.
Definition at line 66 of file VPlanRecipes.cpp.
References llvm::cast(), getCalledFnOperandIndex(), getValue(), and Operands.
Referenced by getCalleeFnAttrs().
|
static |
Return the function attributes of the callee of VPI, which must be a call or intrinsic VPInstruction.
Definition at line 73 of file VPlanRecipes.cpp.
References llvm::Function::getAttributes(), getCalledFunction(), llvm::Type::getContext(), llvm::Intrinsic::getFnAttributes(), llvm::vputils::getIntrinsicID(), llvm::VPInstruction::getOpcode(), llvm::VPRecipeValue::getScalarType(), llvm::VPInstruction::Intrinsic, and llvm::VPUser::operands().
Referenced by llvm::VPRecipeBase::isSafeToSpeculativelyExecute(), llvm::VPRecipeBase::mayHaveSideEffects(), and llvm::VPInstruction::opcodeMayReadOrWriteFromMemory().
|
static |
Returns the ConstantFP V wraps, or nullptr if it does not wrap one.
Definition at line 3241 of file VPlanRecipes.cpp.
References C(), llvm::dyn_cast(), and V.
Referenced by llvm::VPDerivedIVRecipe::computeCost().
|
static |
Returns the execution frequency recorded in Node.
Definition at line 2199 of file VPlanRecipes.cpp.
References assert(), llvm::mdconst::extract(), llvm::bfi_detail::BlockMass::getFull(), and uint64_t.
Referenced by llvm::VPIRMetadata::getExecutionFrequency(), and llvm::VPIRMetadata::print().
|
static |
Definition at line 481 of file VPlanRecipes.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, llvm::cast(), llvm::drop_begin(), and llvm::map_to_vector().
Referenced by llvm::computeScalarTypeForInstruction(), and llvm::VPWidenRecipe::execute().
|
static |
Definition at line 764 of file VPlanRecipes.cpp.
References llvm::FSub, llvm_unreachable, and llvm::Sub.
|
static |
Return a vector containing interleaved elements from multiple smaller input vectors.
Definition at line 4739 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 |
Definition at line 2856 of file VPlanRecipes.cpp.
References llvm::Add, llvm::AddChainWithSubs, llvm::And, llvm::AnyOf, llvm::FAdd, llvm::FAddChainWithSubs, llvm::FindIV, llvm::FindLast, llvm::FMax, llvm::FMaximum, llvm::FMaximumNum, llvm::FMaxNum, llvm::FMin, llvm::FMinimum, llvm::FMinimumNum, llvm::FMinNum, llvm::FMul, llvm::FMulAdd, llvm::FSub, llvm::Mul, llvm::None, llvm::Or, llvm::SMax, llvm::SMin, llvm::Sub, llvm::UMax, llvm::UMin, and llvm::Xor.
Referenced by llvm::VPIRFlags::printFlags(), llvm::VPReductionPHIRecipe::printRecipe(), and llvm::VPReductionRecipe::printRecipe().