LLVM 18.0.0git
|
This file implements a set of utility VPlan to VPlan transformations. More...
#include "VPlanTransforms.h"
#include "VPRecipeBuilder.h"
#include "VPlanAnalysis.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) |
VPValue * | getPredicatedMask (VPRegionBlock *R) |
If R is a region with a VPBranchOnMaskRecipe in the entry block, return the mask. | |
static VPBasicBlock * | getPredicatedThenBlock (VPRegionBlock *R) |
If R is a triangle region, return the 'then' block of the triangle. | |
static bool | mergeReplicateRegionsIntoSuccessors (VPlan &Plan) |
static VPRegionBlock * | createReplicateRegion (VPReplicateRecipe *PredRecipe, VPlan &Plan) |
static void | addReplicateRegions (VPlan &Plan) |
static VPValue * | createScalarIVSteps (VPlan &Plan, const InductionDescriptor &ID, ScalarEvolution &SE, Instruction *TruncI, Type *IVTy, VPValue *StartV, VPValue *Step) |
static bool | canSimplifyBranchOnCond (VPInstruction *Term) |
static VPRegionBlock * | GetReplicateRegion (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, VPTypeAnalysis &TypeInfo) |
Try to simplify recipe R . | |
static void | simplifyRecipes (VPlan &Plan, LLVMContext &Ctx) |
Try to simplify the recipes in Plan . | |
static VPActiveLaneMaskPHIRecipe * | addVPLaneMaskPhiAndUpdateExitBranch (VPlan &Plan, bool DataAndControlFlowWithoutRuntimeCheck) |
This file implements a set of utility VPlan to VPlan transformations.
Definition in file VPlanTransforms.cpp.
|
static |
Definition at line 332 of file VPlanTransforms.cpp.
References llvm::VPBlockUtils::connectBlocks(), createReplicateRegion(), llvm::VPBlockUtils::disconnectBlocks(), llvm::VPlan::getEntry(), llvm::Value::getName(), llvm::VPBlockBase::getParent(), llvm::BasicBlock::getParent(), llvm::Value::hasName(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::setName(), llvm::VPBasicBlock::splitAt(), llvm::SplitBlock(), and llvm::vp_depth_first_deep().
Referenced by llvm::VPlanTransforms::createAndOptimizeReplicateRegions().
|
static |
Definition at line 920 of file VPlanTransforms.cpp.
References llvm::VPInstruction::ActiveLaneMask, llvm::VPInstruction::BranchOnCond, llvm::VPInstruction::CalculateTripCountMinusVF, llvm::VPInstruction::CanonicalIVIncrementForPart, llvm::VPBuilder::createNaryOp(), llvm::VPBuilder::createNot(), llvm::VPBuilder::createOverflowingOp(), llvm::DataAndControlFlowWithoutRuntimeCheck, DL, llvm::VPRecipeBase::eraseFromParent(), llvm::VPlan::getCanonicalIV(), llvm::VPBlockBase::getExitingBasicBlock(), llvm::VPBlockBase::getSinglePredecessor(), llvm::VPBasicBlock::getTerminator(), llvm::VPlan::getTripCount(), llvm::VPlan::getVectorLoopRegion(), and llvm::VPBuilder::setInsertPoint().
Referenced by llvm::VPlanTransforms::addActiveLaneMask().
|
static |
Definition at line 557 of file VPlanTransforms.cpp.
References llvm::VPInstruction::ActiveLaneMask, llvm::VPInstruction::getOpcode(), llvm::VPUser::getOperand(), and llvm::VPInstruction::Not.
Referenced by llvm::VPlanTransforms::optimizeForVFAndUF().
|
static |
Definition at line 296 of file VPlanTransforms.cpp.
References assert(), llvm::VPBlockUtils::connectBlocks(), llvm::VPRecipeBase::eraseFromParent(), llvm::VPReplicateRecipe::getMask(), llvm::VPValue::getNumUsers(), llvm::VPRecipeBase::getUnderlyingInstr(), llvm::VPBlockUtils::insertTwoBlocksAfter(), llvm::VPReplicateRecipe::isUniform(), llvm::make_range(), llvm::VPUser::op_begin(), llvm::VPUser::op_end(), llvm::VPValue::replaceAllUsesWith(), and llvm::VPUser::setOperand().
Referenced by addReplicateRegions().
|
static |
Definition at line 493 of file VPlanTransforms.cpp.
References llvm::VPlan::getCanonicalIV(), llvm::VPValue::getDefiningRecipe(), llvm::VPBlockBase::getEntryBasicBlock(), llvm::VPBasicBlock::getFirstNonPhi(), llvm::Value::getType(), llvm::VPlan::getVectorLoopRegion(), llvm::VPBasicBlock::insert(), and llvm::VPCanonicalIVPHIRecipe::isCanonical().
|
static |
Returns the llvm::Instruction opcode for R
.
Definition at line 794 of file VPlanTransforms.cpp.
Referenced by simplifyRecipe().
VPValue * getPredicatedMask | ( | VPRegionBlock * | R | ) |
If R
is a region with a VPBranchOnMaskRecipe in the entry block, return the mask.
Definition at line 182 of file VPlanTransforms.cpp.
Referenced by mergeReplicateRegionsIntoSuccessors().
|
static |
If R
is a triangle region, return the 'then' block of the triangle.
Definition at line 192 of file VPlanTransforms.cpp.
Referenced by mergeReplicateRegionsIntoSuccessors().
|
static |
Definition at line 608 of file VPlanTransforms.cpp.
References assert().
Referenced by properlyDominates().
Returns true is V
is constant one.
Definition at line 786 of file VPlanTransforms.cpp.
References llvm::CallingConv::C.
Definition at line 214 of file VPlanTransforms.cpp.
References assert(), llvm::VPBlockUtils::connectBlocks(), llvm::SetVector< T, Vector, Set, N >::contains(), llvm::VPBlockUtils::disconnectBlocks(), llvm::SetVector< T, Vector, Set, N >::empty(), llvm::VPlan::getEntry(), llvm::VPBasicBlock::getFirstNonPhi(), getPredicatedMask(), getPredicatedThenBlock(), llvm::VPBlockBase::getSingleSuccessor(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::make_early_inc_range(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::VPValue::replaceUsesWithIf(), llvm::reverse(), and llvm::vp_depth_first_deep().
Referenced by llvm::VPlanTransforms::createAndOptimizeReplicateRegions().
|
static |
Definition at line 622 of file VPlanTransforms.cpp.
References A, assert(), B, GetReplicateRegion(), llvm_unreachable, and llvm::DominatorTreeBase< NodeT, IsPostDom >::properlyDominates().
Referenced by sinkRecurrenceUsersAfterPrevious().
|
static |
Try to simplify recipe R
.
Definition at line 807 of file VPlanTransforms.cpp.
References A, assert(), B, llvm::VPTypeAnalysis::getContext(), getOpcodeForRecipe(), llvm::Type::getScalarSizeInBits(), llvm::VPTypeAnalysis::inferScalarType(), isConstantOne(), and llvm::VPValue::replaceAllUsesWith().
Referenced by simplifyRecipes().
|
static |
Try to simplify the recipes in Plan
.
Definition at line 862 of file VPlanTransforms.cpp.
References llvm::VPlan::getEntry(), llvm::make_early_inc_range(), and simplifyRecipe().
Referenced by llvm::VPlanTransforms::optimize().
|
static |
Sink users of FOR
after the recipe defining the previous value Previous
of the recurrence.
FOR
could be re-arranged as needed or false if it is not possible. Definition at line 652 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().
Definition at line 101 of file VPlanTransforms.cpp.
References llvm::all_of(), llvm::VPlan::getEntry(), llvm::VPBlockBase::getEntryBasicBlock(), llvm::VPBlockBase::getExitingBasicBlock(), llvm::VPBasicBlock::getFirstNonPhi(), llvm::VPRecipeBase::getParent(), llvm::VPBlockBase::getSingleSuccessor(), llvm::VPBlockBase::getSuccessors(), llvm::VPDef::getVPSingleValue(), llvm::VPlan::hasScalarVFOnly(), I, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::VPRecipeBase::mayHaveSideEffects(), llvm::VPRecipeBase::mayReadOrWriteMemory(), llvm::VPRecipeBase::moveBefore(), llvm::VPUser::operands(), llvm::VPValue::replaceUsesWithIf(), llvm::SetVector< T, Vector, Set, N >::size(), llvm::SmallVectorBase< Size_T >::size(), llvm::VPValue::users(), and llvm::vp_depth_first_deep().
Referenced by llvm::VPlanTransforms::createAndOptimizeReplicateRegions().