LLVM 19.0.0git
Macros | Typedefs | Functions | Variables
ExpandVectorPredication.cpp File Reference
#include "llvm/CodeGen/ExpandVectorPredication.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <optional>

Go to the source code of this file.

Macros

#define VPINTERNAL_VPLEGAL_CASES
 
#define VPINTERNAL_CASE(X)   "|" #X
 
#define VPINTERNAL_CASE(X)   .Case(#X, VPLegalization::X)
 
#define DEBUG_TYPE   "expandvp"
 

Typedefs

using VPLegalization = TargetTransformInfo::VPLegalization
 
using VPTransform = TargetTransformInfo::VPLegalization::VPTransform
 

Functions

static VPTransform parseOverrideOption (const std::string &TextOpt)
 
static bool anyExpandVPOverridesSet ()
 
 STATISTIC (NumFoldedVL, "Number of folded vector length params")
 
 STATISTIC (NumLoweredVPOps, "Number of folded vector predication operations")
 
static bool isAllTrueMask (Value *MaskVal)
 
static ConstantgetSafeDivisor (Type *DivTy)
 
static void transferDecorations (Value &NewVal, VPIntrinsic &VPI)
 Transfer operation properties from OldVPI to NewVal.
 
static void replaceOperation (Value &NewOp, VPIntrinsic &OldOp)
 Transfer all properties from OldOp to NewOp and replace all uses.
 
static bool maySpeculateLanes (VPIntrinsic &VPI)
 
 INITIALIZE_PASS_BEGIN (ExpandVectorPredication, "expandvp", "Expand vector predication intrinsics", false, false) INITIALIZE_PASS_END(ExpandVectorPredication
 

Variables

static cl::opt< std::string > EVLTransformOverride ("expandvp-override-evl-transform", cl::init(""), cl::Hidden, cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, ignore " "TargetTransformInfo and " "always use this transformation for the %evl parameter (Used in " "testing)."))
 
static cl::opt< std::string > MaskTransformOverride ("expandvp-override-mask-transform", cl::init(""), cl::Hidden, cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, Ignore " "TargetTransformInfo and " "always use this transformation for the %mask parameter (Used in " "testing)."))
 
 expandvp
 
Expand vector predication intrinsics
 
Expand vector predication false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "expandvp"

Definition at line 78 of file ExpandVectorPredication.cpp.

◆ VPINTERNAL_CASE [1/2]

#define VPINTERNAL_CASE (   X)    "|" #X

Definition at line 65 of file ExpandVectorPredication.cpp.

◆ VPINTERNAL_CASE [2/2]

#define VPINTERNAL_CASE (   X)    .Case(#X, VPLegalization::X)

Definition at line 65 of file ExpandVectorPredication.cpp.

◆ VPINTERNAL_VPLEGAL_CASES

#define VPINTERNAL_VPLEGAL_CASES
Value:
VPINTERNAL_CASE(Discard) \
VPINTERNAL_CASE(Convert)
#define VPINTERNAL_CASE(X)

Definition at line 40 of file ExpandVectorPredication.cpp.

Typedef Documentation

◆ VPLegalization

Definition at line 36 of file ExpandVectorPredication.cpp.

◆ VPTransform

Definition at line 37 of file ExpandVectorPredication.cpp.

Function Documentation

◆ anyExpandVPOverridesSet()

static bool anyExpandVPOverridesSet ( )
static

Definition at line 74 of file ExpandVectorPredication.cpp.

References EVLTransformOverride, and MaskTransformOverride.

◆ getSafeDivisor()

static Constant * getSafeDivisor ( Type DivTy)
static
Returns
A non-excepting divisor constant for this type.

Definition at line 95 of file ExpandVectorPredication.cpp.

References assert(), and llvm::Type::isIntOrIntVectorTy().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( ExpandVectorPredication  ,
"expandvp"  ,
"Expand vector predication intrinsics"  ,
false  ,
false   
)

◆ isAllTrueMask()

static bool isAllTrueMask ( Value MaskVal)
static
Returns
Whether the vector mask MaskVal has all lane bits set.

Definition at line 86 of file ExpandVectorPredication.cpp.

References llvm::getSplatValue().

◆ maySpeculateLanes()

static bool maySpeculateLanes ( VPIntrinsic VPI)
static

◆ parseOverrideOption()

static VPTransform parseOverrideOption ( const std::string &  TextOpt)
static

Definition at line 67 of file ExpandVectorPredication.cpp.

References VPINTERNAL_VPLEGAL_CASES.

◆ replaceOperation()

static void replaceOperation ( Value NewOp,
VPIntrinsic OldOp 
)
static

Transfer all properties from OldOp to NewOp and replace all uses.

OldVP gets erased.

Definition at line 115 of file ExpandVectorPredication.cpp.

References llvm::Instruction::eraseFromParent(), llvm::Value::replaceAllUsesWith(), and transferDecorations().

◆ STATISTIC() [1/2]

STATISTIC ( NumFoldedVL  ,
"Number of folded vector length params"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumLoweredVPOps  ,
"Number of folded vector predication operations"   
)

◆ transferDecorations()

static void transferDecorations ( Value NewVal,
VPIntrinsic VPI 
)
static

Transfer operation properties from OldVPI to NewVal.

Definition at line 101 of file ExpandVectorPredication.cpp.

Referenced by replaceOperation().

Variable Documentation

◆ EVLTransformOverride

cl::opt< std::string > EVLTransformOverride("expandvp-override-evl-transform", cl::init(""), cl::Hidden, cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, ignore " "TargetTransformInfo and " "always use this transformation for the %evl parameter (Used in " "testing).")) ( "expandvp-override-evl-transform"  ,
cl::init("")  ,
cl::Hidden  ,
cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, ignore " "TargetTransformInfo and " "always use this transformation for the %evl parameter (Used in " "testing).")   
)
static

Referenced by anyExpandVPOverridesSet().

◆ expandvp

expandvp

Definition at line 884 of file ExpandVectorPredication.cpp.

◆ false

Expand vector predication false

Definition at line 885 of file ExpandVectorPredication.cpp.

◆ intrinsics

Expand vector predication intrinsics

Definition at line 885 of file ExpandVectorPredication.cpp.

◆ MaskTransformOverride

cl::opt< std::string > MaskTransformOverride("expandvp-override-mask-transform", cl::init(""), cl::Hidden, cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, Ignore " "TargetTransformInfo and " "always use this transformation for the %mask parameter (Used in " "testing).")) ( "expandvp-override-mask-transform"  ,
cl::init("")  ,
cl::Hidden  ,
cl::desc("Options: <empty>" VPINTERNAL_VPLEGAL_CASES ". If non-empty, Ignore " "TargetTransformInfo and " "always use this transformation for the %mask parameter (Used in " "testing).")   
)
static

Referenced by anyExpandVPOverridesSet().