|
LLVM 23.0.0git
|
Helper class to create VPRecipies from IR instructions. More...
#include "Transforms/Vectorize/VPRecipeBuilder.h"
Public Member Functions | |
| VPRecipeBuilder (VPlan &Plan, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, VPBuilder &Builder) | |
| bool | isPredicatedInst (Instruction *I) const |
Returns true if I needs to be predicated (i.e. | |
| bool | prefersVectorizedAddressing () const |
| Returns true if the target prefers vectorized addressing. | |
| VPRecipeBase * | tryToCreateWidenNonPhiRecipe (VPSingleDefRecipe *R, VFRange &Range) |
Create and return a widened recipe for a non-phi recipe R if one can be created within the given VF Range. | |
| VPRecipeBase * | tryToWidenMemory (VPInstruction *VPI, VFRange &Range) |
Check if the load or store instruction VPI should widened for Range.Start and potentially masked. | |
| VPHistogramRecipe * | widenIfHistogram (VPInstruction *VPI) |
If VPI represents a histogram operation (as determined by LoopVectorizationLegality) make that safe for vectorization, by emitting a llvm.experimental.vector.histogram.add intrinsic in place of the Load + Add|Sub + Store operations that perform the histogram in the original scalar loop. | |
| bool | replaceWithFinalIfReductionStore (VPInstruction *VPI, VPBuilder &FinalRedStoresBuilder) |
If VPI is a store of a reduction into an invariant address, delete it. | |
| VPSingleDefRecipe * | handleReplication (VPInstruction *VPI, VFRange &Range) |
Build a replicating or single-scalar recipe for VPI. | |
Helper class to create VPRecipies from IR instructions.
Definition at line 24 of file VPRecipeBuilder.h.
|
inline |
Definition at line 52 of file VPRecipeBuilder.h.
| VPSingleDefRecipe * VPRecipeBuilder::handleReplication | ( | VPInstruction * | VPI, |
| VFRange & | Range ) |
Build a replicating or single-scalar recipe for VPI.
If it is predicated, add the mask as last operand. Range.End may be decreased to ensure same recipe behavior from Range.Start to Range.End.
Definition at line 6397 of file LoopVectorize.cpp.
References assert(), llvm::cast(), llvm::VPBuilder::createSingleScalarOp(), llvm::dbgs(), llvm::VPRecipeBase::getDebugLoc(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), getIntrinsicID(), llvm::VPInstruction::getMask(), llvm::VPInstruction::getOpcode(), llvm::VPSingleDefRecipe::getUnderlyingInstr(), I, llvm::isa(), LLVM_DEBUG, llvm::VPInstruction::operandsWithoutMask(), and Range.
Referenced by llvm::VPlanTransforms::makeCallWideningDecisions(), and llvm::VPlanTransforms::makeMemOpWideningDecisions().
| bool VPRecipeBuilder::isPredicatedInst | ( | Instruction * | I | ) | const |
Returns true if I needs to be predicated (i.e.
cannot be executed unconditionally for all lanes) in the loop being vectorized. FIXME: Fully migrate logic to determine if mask is needed to VPlan.
Definition at line 6150 of file LoopVectorize.cpp.
References I.
Referenced by llvm::VPlanTransforms::makeMemOpWideningDecisions().
| bool VPRecipeBuilder::prefersVectorizedAddressing | ( | ) | const |
Returns true if the target prefers vectorized addressing.
Definition at line 6154 of file LoopVectorize.cpp.
Referenced by llvm::VPlanTransforms::makeMemOpWideningDecisions().
| bool VPRecipeBuilder::replaceWithFinalIfReductionStore | ( | VPInstruction * | VPI, |
| VPBuilder & | FinalRedStoresBuilder ) |
If VPI is a store of a reduction into an invariant address, delete it.
If it is the final store of a reduction result, a uniform store recipe will be created for it in the middle block. Returns true if replacement took place. The order of stores must be preserved, hence FinalRedStoresBuidler.
Definition at line 6368 of file LoopVectorize.cpp.
References assert(), llvm::dyn_cast(), llvm::VPRecipeBase::eraseFromParent(), llvm::VPlanPatternMatch::findUserOf(), llvm::VPRecipeBase::getDebugLoc(), llvm::VPUser::getOperand(), llvm::VPSingleDefRecipe::getUnderlyingInstr(), and llvm::VPBuilder::insert().
Referenced by llvm::VPlanTransforms::makeMemOpWideningDecisions().
| VPRecipeBase * VPRecipeBuilder::tryToCreateWidenNonPhiRecipe | ( | VPSingleDefRecipe * | R, |
| VFRange & | Range ) |
Create and return a widened recipe for a non-phi recipe R if one can be created within the given VF Range.
Definition at line 6467 of file LoopVectorize.cpp.
References assert(), llvm::cast(), GEP, llvm::VPRecipeBase::getDebugLoc(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), llvm::Instruction::getOpcode(), llvm::VPInstruction::getOpcode(), llvm::VPUser::getOperand(), llvm::is_contained(), llvm::Instruction::isCast(), llvm::ElementCount::isScalar(), llvm::VPInstruction::operandsWithoutMask(), and Range.
| VPRecipeBase * VPRecipeBuilder::tryToWidenMemory | ( | VPInstruction * | VPI, |
| VFRange & | Range ) |
Check if the load or store instruction VPI should widened for Range.Start and potentially masked.
Such instructions are handled by a recipe that takes an additional VPInstruction for the mask.
Definition at line 6158 of file LoopVectorize.cpp.
References assert(), llvm::cast(), llvm::LoopVectorizationCostModel::CM_Interleave, llvm::LoopVectorizationCostModel::CM_Scalarize, llvm::LoopVectorizationCostModel::CM_Unknown, llvm::LoopVectorizationCostModel::CM_Widen, llvm::LoopVectorizationCostModel::CM_Widen_Reverse, DL, llvm::VPRecipeBase::getDebugLoc(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), llvm::vputils::getGEPFlagsForPtr(), llvm::getLoadStoreType(), llvm::VPInstruction::getMask(), llvm::VPInstruction::getOpcode(), llvm::VPUser::getOperand(), llvm::Value::getType(), llvm::VPSingleDefRecipe::getUnderlyingInstr(), llvm::VPValue::getUnderlyingValue(), I, llvm::GEPNoWrapFlags::none(), Range, llvm::Reverse, and llvm::VPInstruction::Reverse.
Referenced by llvm::VPlanTransforms::makeMemOpWideningDecisions().
| VPHistogramRecipe * VPRecipeBuilder::widenIfHistogram | ( | VPInstruction * | VPI | ) |
If VPI represents a histogram operation (as determined by LoopVectorizationLegality) make that safe for vectorization, by emitting a llvm.experimental.vector.histogram.add intrinsic in place of the Load + Add|Sub + Store operations that perform the histogram in the original scalar loop.
Definition at line 6338 of file LoopVectorize.cpp.
References assert(), llvm::cast(), llvm::VPRecipeBase::getDebugLoc(), llvm::VPInstruction::getMask(), llvm::VPInstruction::getOpcode(), llvm::VPUser::getOperand(), llvm::VPSingleDefRecipe::getUnderlyingInstr(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::VPlanTransforms::makeMemOpWideningDecisions().