LLVM 18.0.0git
Functions
VPlanTransforms.cpp File Reference

This file implements a set of utility VPlan to VPlan transformations. More...

#include "VPlanTransforms.h"
#include "VPRecipeBuilder.h"
#include "VPlanCFG.h"
#include "VPlanDominatorTree.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/IVDescriptors.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/PatternMatch.h"

Go to the source code of this file.

Functions

static bool sinkScalarOperands (VPlan &Plan)
 
VPValuegetPredicatedMask (VPRegionBlock *R)
 If R is a region with a VPBranchOnMaskRecipe in the entry block, return the mask.
 
static VPBasicBlockgetPredicatedThenBlock (VPRegionBlock *R)
 If R is a triangle region, return the 'then' block of the triangle.
 
static bool mergeReplicateRegionsIntoSuccessors (VPlan &Plan)
 
static VPRegionBlockcreateReplicateRegion (VPReplicateRecipe *PredRecipe, VPlan &Plan)
 
static void addReplicateRegions (VPlan &Plan)
 
static VPValuecreateScalarIVSteps (VPlan &Plan, const InductionDescriptor &ID, ScalarEvolution &SE, Instruction *TruncI, Type *IVTy, VPValue *StartV, VPValue *Step)
 
static bool canSimplifyBranchOnCond (VPInstruction *Term)
 
static VPRegionBlockGetReplicateRegion (VPRecipeBase *R)
 
static bool properlyDominates (const VPRecipeBase *A, const VPRecipeBase *B, VPDominatorTree &VPDT)
 
static bool sinkRecurrenceUsersAfterPrevious (VPFirstOrderRecurrencePHIRecipe *FOR, VPRecipeBase *Previous, VPDominatorTree &VPDT)
 Sink users of FOR after the recipe defining the previous value Previous of the recurrence.
 
static bool isConstantOne (VPValue *V)
 Returns true is V is constant one.
 
static unsigned getOpcodeForRecipe (VPRecipeBase &R)
 Returns the llvm::Instruction opcode for R.
 
static void simplifyRecipe (VPRecipeBase &R)
 Try to simplify recipe R.
 
static void simplifyRecipes (VPlan &Plan)
 Try to simplify the recipes in Plan.
 
static VPActiveLaneMaskPHIRecipeaddVPLaneMaskPhiAndUpdateExitBranch (VPlan &Plan, bool DataAndControlFlowWithoutRuntimeCheck)
 

Detailed Description

This file implements a set of utility VPlan to VPlan transformations.

Definition in file VPlanTransforms.cpp.

Function Documentation

◆ addReplicateRegions()

static void addReplicateRegions ( VPlan Plan)
static

◆ addVPLaneMaskPhiAndUpdateExitBranch()

static VPActiveLaneMaskPHIRecipe * addVPLaneMaskPhiAndUpdateExitBranch ( VPlan Plan,
bool  DataAndControlFlowWithoutRuntimeCheck 
)
static

◆ canSimplifyBranchOnCond()

static bool canSimplifyBranchOnCond ( VPInstruction Term)
static

◆ createReplicateRegion()

static VPRegionBlock * createReplicateRegion ( VPReplicateRecipe PredRecipe,
VPlan Plan 
)
static

◆ createScalarIVSteps()

static VPValue * createScalarIVSteps ( VPlan Plan,
const InductionDescriptor ID,
ScalarEvolution SE,
Instruction TruncI,
Type IVTy,
VPValue StartV,
VPValue Step 
)
static

◆ getOpcodeForRecipe()

static unsigned getOpcodeForRecipe ( VPRecipeBase R)
static

Returns the llvm::Instruction opcode for R.

Definition at line 812 of file VPlanTransforms.cpp.

Referenced by simplifyRecipe().

◆ getPredicatedMask()

VPValue * getPredicatedMask ( VPRegionBlock R)

If R is a region with a VPBranchOnMaskRecipe in the entry block, return the mask.

Definition at line 188 of file VPlanTransforms.cpp.

Referenced by mergeReplicateRegionsIntoSuccessors().

◆ getPredicatedThenBlock()

static VPBasicBlock * getPredicatedThenBlock ( VPRegionBlock R)
static

If R is a triangle region, return the 'then' block of the triangle.

Definition at line 198 of file VPlanTransforms.cpp.

Referenced by mergeReplicateRegionsIntoSuccessors().

◆ GetReplicateRegion()

static VPRegionBlock * GetReplicateRegion ( VPRecipeBase R)
static

Definition at line 626 of file VPlanTransforms.cpp.

References assert().

Referenced by properlyDominates().

◆ isConstantOne()

static bool isConstantOne ( VPValue V)
static

Returns true is V is constant one.

Definition at line 804 of file VPlanTransforms.cpp.

References llvm::CallingConv::C.

◆ mergeReplicateRegionsIntoSuccessors()

static bool mergeReplicateRegionsIntoSuccessors ( VPlan Plan)
static

◆ properlyDominates()

static bool properlyDominates ( const VPRecipeBase A,
const VPRecipeBase B,
VPDominatorTree VPDT 
)
static

◆ simplifyRecipe()

static void simplifyRecipe ( VPRecipeBase R)
static

Try to simplify recipe R.

Definition at line 823 of file VPlanTransforms.cpp.

References A, B, getOpcodeForRecipe(), and isConstantOne().

Referenced by simplifyRecipes().

◆ simplifyRecipes()

static void simplifyRecipes ( VPlan Plan)
static

Try to simplify the recipes in Plan.

Definition at line 836 of file VPlanTransforms.cpp.

References llvm::VPlan::getEntry(), llvm::make_early_inc_range(), and simplifyRecipe().

Referenced by llvm::VPlanTransforms::optimize().

◆ sinkRecurrenceUsersAfterPrevious()

static bool sinkRecurrenceUsersAfterPrevious ( VPFirstOrderRecurrencePHIRecipe FOR,
VPRecipeBase Previous,
VPDominatorTree VPDT 
)
static

Sink users of FOR after the recipe defining the previous value Previous of the recurrence.

Returns
true if all users of FOR could be re-arranged as needed or false if it is not possible.

Definition at line 670 of file VPlanTransforms.cpp.

References A, assert(), B, llvm::VPDef::getNumDefinedValues(), llvm::VPDef::getVPSingleValue(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), properlyDominates(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), llvm::sort(), and llvm::VPValue::users().

Referenced by llvm::VPlanTransforms::adjustFixedOrderRecurrences().

◆ sinkScalarOperands()

static bool sinkScalarOperands ( VPlan Plan)
static