LLVM 22.0.0git
VPlanRecipes.cpp File Reference

This file contains implementations for different VPlan recipes. More...

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 BranchInstcreateCondBranch (Value *Cond, VPBasicBlock *VPBB, VPTransformState &State)
 Create a conditional branch using Cond branching to the successors of VPBB.
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 ConstantgetSignedIntOrFpConstant (Type *Ty, int64_t C)
 A helper function that returns an integer or floating-point constant with value C.
static TypegetGEPIndexTy (bool IsScalable, bool IsReverse, bool IsUnitStride, unsigned CurrentPart, IRBuilderBase &Builder)
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 SCEVgetAddressAccessSCEV (const VPValue *Ptr, ScalarEvolution &SE, 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 InstructioncreateReverseEVL (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 ValuecreateBitOrPointerCast (IRBuilderBase &Builder, Value *V, VectorType *DstVTy, const DataLayout &DL)
static ValueinterleaveVectors (IRBuilderBase &Builder, ArrayRef< Value * > Vals, const Twine &Name)
 Return a vector containing interleaved elements from multiple smaller input vectors.

Detailed Description

This file contains implementations for different VPlan recipes.

Definition in file VPlanRecipes.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   LV_NAME

Definition at line 48 of file VPlanRecipes.cpp.

◆ LV_NAME

#define LV_NAME   "loop-vectorize"

Definition at line 47 of file VPlanRecipes.cpp.

Typedef Documentation

◆ VectorParts

using VectorParts = SmallVector<Value *, 2>

Definition at line 45 of file VPlanRecipes.cpp.

Function Documentation

◆ createBitOrPointerCast()

◆ createCondBranch()

BranchInst * createCondBranch ( Value * Cond,
VPBasicBlock * VPBB,
VPTransformState & State )
static

Create a conditional branch using Cond branching to the successors of VPBB.

Note that the first successor is always forward (i.e. not created yet) while the second successor may already have been created (if it is a header block and VPBB is a latch).

Definition at line 599 of file VPlanRecipes.cpp.

References llvm::cast(), Cond, llvm::Instruction::eraseFromParent(), llvm::VPBlockBase::getSuccessors(), llvm::BasicBlock::getTerminator(), and llvm::BranchInst::setSuccessor().

◆ createReverseEVL()

Instruction * createReverseEVL ( IRBuilderBase & Builder,
Value * Operand,
Value * EVL,
const Twine & Name )
static

Use all-true mask for reverse rather than actual mask, as it avoids a dependence w/o affecting the result.

Definition at line 3631 of file VPlanRecipes.cpp.

References llvm::cast(), and llvm::Value::getType().

Referenced by llvm::VPWidenLoadEVLRecipe::execute(), and llvm::VPWidenStoreEVLRecipe::execute().

◆ getAddressAccessSCEV()

const SCEV * getAddressAccessSCEV ( const VPValue * Ptr,
ScalarEvolution & SE,
const Loop * L )
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 3180 of file VPlanRecipes.cpp.

References llvm::cast(), llvm::drop_begin(), getOpcode(), llvm::vputils::getSCEVExprForVPValue(), llvm::isa(), llvm::VPlanPatternMatch::m_GetElementPtr(), llvm::VPlanPatternMatch::m_VPValue(), llvm::PatternMatch::match(), and Ptr.

◆ getCostForIntrinsics()

◆ getGEPIndexTy()

Type * getGEPIndexTy ( bool IsScalable,
bool IsReverse,
bool IsUnitStride,
unsigned CurrentPart,
IRBuilderBase & Builder )
static

◆ getSignedIntOrFpConstant()

Constant * getSignedIntOrFpConstant ( Type * Ty,
int64_t C )
static

A helper function that returns an integer or floating-point constant with value C.

Definition at line 2355 of file VPlanRecipes.cpp.

References llvm::CallingConv::C, and llvm::ConstantInt::getSigned().

Referenced by llvm::VPScalarIVStepsRecipe::execute().

◆ interleaveVectors()

Value * interleaveVectors ( IRBuilderBase & Builder,
ArrayRef< Value * > Vals,
const Twine & Name )
static

Return a vector containing interleaved elements from multiple smaller input vectors.

Definition at line 3847 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().

◆ isUsedByLoadStoreAddress()

bool isUsedByLoadStoreAddress ( const VPUser * V)
static

◆ scalarizeInstruction()