LLVM 20.0.0git
Namespaces | Macros | Typedefs | Functions | Variables
VPlanRecipes.cpp File Reference

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

#include "VPlan.h"
#include "VPlanAnalysis.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/IVDescriptors.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.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 "llvm/Transforms/Utils/ScalarEvolutionExpander.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 InstructiongetInstructionForCost (const VPRecipeBase *R)
 Return the underlying instruction to be used for computing R's cost via the legacy cost model.
 
static ValuegetStepVector (Value *Val, Value *StartIdx, Value *Step, Instruction::BinaryOps BinOp, ElementCount VF, IRBuilderBase &Builder)
 This function adds (StartIdx * Step, (StartIdx + 1) * Step, (StartIdx + 2) * Step, ...) to each vector element of Val.
 
static ConstantgetSignedIntOrFpConstant (Type *Ty, int64_t C)
 A helper function that returns an integer or floating-point constant with value C.
 
static ValuegetRuntimeVFAsFloat (IRBuilderBase &B, Type *FTy, ElementCount VF)
 
static bool isUniformAcrossVFsAndUFs (VPScalarCastRecipe *C)
 Checks if C is uniform across all VFs and UFs.
 
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.
 

Variables

cl::opt< unsignedForceTargetInstructionCost
 

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 45 of file VPlanRecipes.cpp.

◆ LV_NAME

#define LV_NAME   "loop-vectorize"

Definition at line 44 of file VPlanRecipes.cpp.

Typedef Documentation

◆ VectorParts

using VectorParts = SmallVector<Value *, 2>

Definition at line 37 of file VPlanRecipes.cpp.

Function Documentation

◆ createBitOrPointerCast()

static Value * createBitOrPointerCast ( IRBuilderBase Builder,
Value V,
VectorType DstVTy,
const DataLayout DL 
)
static

◆ getInstructionForCost()

static Instruction * getInstructionForCost ( const VPRecipeBase R)
static

Return the underlying instruction to be used for computing R's cost via the legacy cost model.

Return nullptr if there's no suitable instruction.

Definition at line 269 of file VPlanRecipes.cpp.

Referenced by llvm::VPRecipeBase::computeCost(), and llvm::VPRecipeBase::cost().

◆ getRuntimeVFAsFloat()

static Value * getRuntimeVFAsFloat ( IRBuilderBase B,
Type FTy,
ElementCount  VF 
)
static

◆ getSignedIntOrFpConstant()

static 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 1309 of file VPlanRecipes.cpp.

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

Referenced by llvm::VPWidenIntOrFpInductionRecipe::execute(), and llvm::VPScalarIVStepsRecipe::execute().

◆ getStepVector()

static Value * getStepVector ( Value Val,
Value StartIdx,
Value Step,
Instruction::BinaryOps  BinOp,
ElementCount  VF,
IRBuilderBase Builder 
)
static

◆ interleaveVectors()

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

◆ isUniformAcrossVFsAndUFs()

static bool isUniformAcrossVFsAndUFs ( VPScalarCastRecipe C)
static

Checks if C is uniform across all VFs and UFs.

It is considered as such if it is either defined outside the vector region or its operand is known to be uniform across all VFs and UFs (e.g. VPDerivedIV or VPCanonicalIVPHI). TODO: Uniformity should be associated with a VPValue and there should be a generic way to check.

Definition at line 1952 of file VPlanRecipes.cpp.

References llvm::CallingConv::C.

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

Variable Documentation

◆ ForceTargetInstructionCost

cl::opt<unsigned> ForceTargetInstructionCost
extern