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 bool shouldUseAddressAccessSCEV (const VPValue *Ptr)
 Returns true if Ptr 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 47 of file VPlanRecipes.cpp.

◆ LV_NAME

#define LV_NAME   "loop-vectorize"

Definition at line 46 of file VPlanRecipes.cpp.

Typedef Documentation

◆ VectorParts

using VectorParts = SmallVector<Value *, 2>

Definition at line 44 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 571 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 3511 of file VPlanRecipes.cpp.

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

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

◆ 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 2313 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 3730 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()

◆ shouldUseAddressAccessSCEV()

bool shouldUseAddressAccessSCEV ( const VPValue * Ptr)
static

Returns true if Ptr is a pointer computation for which the legacy cost model computes a SCEV expression when computing the address cost.

Definition at line 3074 of file VPlanRecipes.cpp.

References llvm::cast(), llvm::drop_begin(), getOpcode(), llvm::isa(), and Ptr.

Referenced by llvm::VPReplicateRecipe::computeCost().