LLVM 24.0.0git
VPlanEVLTailFolding.cpp File Reference

This file implements the VPlan-to-VPlan transforms related to explicit vector length (EVL) tail folding support. More...

#include "LoopVectorizationPlanner.h"
#include "VPlan.h"
#include "VPlanCFG.h"
#include "VPlanHelpers.h"
#include "VPlanPatternMatch.h"
#include "VPlanTransforms.h"
#include "VPlanUtils.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/IR/Intrinsics.h"

Go to the source code of this file.

Functions

static std::optional< Intrinsic::IDgetVPDivRemIntrinsic (Intrinsic::ID IntrID)
static VPRecipeBaseoptimizeMaskToEVL (VPValue *HeaderMask, VPRecipeBase &CurRecipe, VPValue &EVL)
 Try to optimize a CurRecipe masked by HeaderMask to a corresponding EVL-based recipe without the header mask.
static bool optimizeExpressionRecipeToEVL (VPValue *HeaderMask, VPRecipeBase &CurRecipe, VPValue &EVL, SmallVector< VPRecipeBase * > &OldRecipes)
static void fixupVFUsersForEVL (VPlan &Plan, VPValue &EVL)
 After replacing the canonical IV with a EVL-based IV, fixup recipes that use VF to use the EVL instead to avoid incorrect updates on the penultimate iteration.

Detailed Description

This file implements the VPlan-to-VPlan transforms related to explicit vector length (EVL) tail folding support.

Definition in file VPlanEVLTailFolding.cpp.

Function Documentation

◆ fixupVFUsersForEVL()

◆ getVPDivRemIntrinsic()

std::optional< Intrinsic::ID > getVPDivRemIntrinsic ( Intrinsic::ID IntrID)
static

Definition at line 64 of file VPlanEVLTailFolding.cpp.

Referenced by optimizeMaskToEVL().

◆ optimizeExpressionRecipeToEVL()

◆ optimizeMaskToEVL()

VPRecipeBase * optimizeMaskToEVL ( VPValue * HeaderMask,
VPRecipeBase & CurRecipe,
VPValue & EVL )
static

Try to optimize a CurRecipe masked by HeaderMask to a corresponding EVL-based recipe without the header mask.

Returns nullptr if no EVL-based recipe could be created. HeaderMask Header Mask. CurRecipe Recipe to be transform. EVL The explicit vector length parameter of vector-predication intrinsics.

Adjust any end pointers so that they point to the end of EVL lanes not VF.

Definition at line 86 of file VPlanEVLTailFolding.cpp.

References llvm::cast(), llvm::VPBuilder::createScalarZExtOrTrunc(), DL, llvm::dyn_cast(), llvm::VPlan::getConstantInt(), llvm::VPRecipeBase::getDebugLoc(), llvm::VPIRFlags::getDefaultFlags(), llvm::VPRecipeBase::getParent(), llvm::VPBlockBase::getPlan(), llvm::VPlan::getPoison(), llvm::VPValue::getScalarType(), llvm::VPlan::getTrue(), llvm::DebugLoc::getUnknown(), llvm::VPlan::getVF(), getVPDivRemIntrinsic(), llvm::VPDef::getVPSingleValue(), llvm::VPRecipeBase::insertBefore(), LHS, llvm::VPlanPatternMatch::m_c_BinaryOr(), llvm::PatternMatch::m_Intrinsic(), llvm::VPlanPatternMatch::m_LastActiveLane(), llvm::PatternMatch::m_LogicalAnd(), llvm::PatternMatch::m_MaskedLoad(), llvm::PatternMatch::m_MaskedStore(), llvm::VPlanPatternMatch::m_RemoveMask(), llvm::VPlanPatternMatch::m_Reverse(), llvm::PatternMatch::m_SelectLike(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_TruncOrSelf(), llvm::VPlanPatternMatch::m_VecEndPtr(), llvm::VPlanPatternMatch::m_VPValue(), llvm::PatternMatch::match(), Poison, llvm::Reverse, and RHS.

Referenced by llvm::VPlanTransforms::optimizeEVLMasks(), and optimizeExpressionRecipeToEVL().