LLVM 24.0.0git
SLPUtils.h File Reference
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Intrinsics.h"
#include <optional>
#include <string>

Go to the source code of this file.

Classes

struct  llvm::slpvectorizer::NarrowedLeafInfo
 Narrow reduction leaf: the value, the shift applied after widening and the mask applied in the narrow type before widening, clearing the bits the absorbed narrow shls shift out and applying the absorbed narrow and-masks. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
namespace  llvm::slpvectorizer
 A private "module" namespace for types and utilities used by this pass.

Enumerations

enum class  llvm::slpvectorizer::UseMask { llvm::slpvectorizer::FirstArg , llvm::slpvectorizer::SecondArg , llvm::slpvectorizer::UndefsAsMask }
 Specifies the way the mask should be analyzed for undefs/poisonous elements in the shuffle mask. More...

Functions

bool llvm::slpvectorizer::isConstant (Value *V)
bool llvm::slpvectorizer::isBinOpIdentityConstant (const Value *V, unsigned Opcode)
unsigned llvm::slpvectorizer::getReassocCombineOpcode (unsigned Opcode)
bool llvm::slpvectorizer::isReassocChainLink (const Instruction *I)
bool llvm::slpvectorizer::isVectorLikeInstWithConstOps (Value *V)
 Checks if V is one of vector-like instructions, i.e.
unsigned llvm::slpvectorizer::getNumElements (Type *Ty)
unsigned llvm::slpvectorizer::getPartNumElems (unsigned Size, unsigned NumParts)
 Returns power-of-2 number of elements in a single register (part), given the total number of elements Size and number of registers (parts) NumParts.
unsigned llvm::slpvectorizer::getNumElems (unsigned Size, unsigned PartNumElems, unsigned Part)
 Returns correct remaining number of elements, considering total amount Size, (power-of-2 number) of elements in a single register PartNumElems and current register (part) Part.
std::string llvm::slpvectorizer::shortBundleName (ArrayRef< Value * > VL, int Idx=-1)
 Print a short descriptor of the instruction bundle suitable for debug output.
bool llvm::slpvectorizer::allSameBlock (ArrayRef< Value * > VL)
bool llvm::slpvectorizer::allConstant (ArrayRef< Value * > VL)
bool llvm::slpvectorizer::isSplat (ArrayRef< Value * > VL)
Intrinsic::ID llvm::slpvectorizer::isEquivalentIntrinsicID (Intrinsic::ID LHS, Intrinsic::ID RHS)
 Checks if LHS and RHS are the same intrinsic, or one is llvm.fma and the other is llvm.fmuladd, since both lower to the same fused vector operation.
bool llvm::slpvectorizer::isCommutative (const Instruction *I, const Value *ValWithUses, bool IsCopyable)
bool llvm::slpvectorizer::isCommutative (const Instruction *I)
 This is a helper function to check whether I is commutative.
bool llvm::slpvectorizer::isCommutableOperand (const Instruction *I, Value *ValWithUses, unsigned Op, bool IsCopyable=false)
 Checks if the operand is commutative.
unsigned llvm::slpvectorizer::getNumberOfPotentiallyCommutativeOps (Instruction *I)
std::optional< unsignedllvm::slpvectorizer::getElementIndex (const Value *Inst, unsigned Offset)
bool llvm::slpvectorizer::allSameOpcode (ArrayRef< Value * > VL)
std::optional< unsignedllvm::slpvectorizer::getExtractIndex (const Instruction *E)
void llvm::slpvectorizer::inversePermutation (ArrayRef< unsigned > Indices, SmallVectorImpl< int > &Mask)
 Compute the inverse permutation Mask of Indices.
void llvm::slpvectorizer::reorderScalars (SmallVectorImpl< Value * > &Scalars, ArrayRef< int > Mask)
 Reorders the list of scalars in accordance with the given Mask.
bool llvm::slpvectorizer::allSameType (ArrayRef< Value * > VL)
bool llvm::slpvectorizer::areAllOperandsNonInsts (Value *V)
 Checks if the provided value does not require scheduling.
bool llvm::slpvectorizer::isUsedOutsideBlock (Value *V)
 Checks if the provided value does not require scheduling.
bool llvm::slpvectorizer::doesNotNeedToBeScheduled (Value *V)
 Checks if the specified value does not require scheduling.
bool llvm::slpvectorizer::doesNotNeedToSchedule (ArrayRef< Value * > VL)
 Checks if the specified array of instructions does not require scheduling.
template<typename T>
std::optional< unsignedllvm::slpvectorizer::getInsertExtractIndex (const Value *Inst, unsigned Offset)
void llvm::slpvectorizer::transformScalarShuffleIndiciesToVector (unsigned VecTyNumElements, SmallVectorImpl< int > &Mask)
unsigned llvm::slpvectorizer::getShufflevectorNumGroups (ArrayRef< Value * > VL)
SmallVector< int > llvm::slpvectorizer::calculateShufflevectorMask (ArrayRef< Value * > VL)
SmallBitVector llvm::slpvectorizer::buildUseMask (int VF, ArrayRef< int > Mask, UseMask MaskArg)
 Prepares a use bitset for the given mask either for the first argument or for the second.
template<bool IsPoisonOnly>
SmallBitVector llvm::slpvectorizer::isUndefVector (const Value *V, const SmallBitVector &UseMask={})
 Checks if the given value is actually an undefined constant vector.
bool llvm::slpvectorizer::doesInTreeUserNeedToExtract (Value *Scalar, Instruction *UserInst, TargetLibraryInfo *TLI, const TargetTransformInfo *TTI)
MemoryLocation llvm::slpvectorizer::getLocation (Instruction *I)
bool llvm::slpvectorizer::isSimple (Instruction *I)
bool llvm::slpvectorizer::isSelectedBaseLoad (Type *ScalarTy, ArrayRef< Value * > PointerOps, const DataLayout &DL, Value *&TrueBase, Value *&FalseBase, SmallVectorImpl< Value * > &Conditions)
 Checks if the loads with scalar type ScalarTy and pointer operands PointerOps are each (optionally via a constant-offset GEP) a select Cond, A, B picking between the same two base pointers A/B on every lane - the shape a fully unrolled x = cond ?
void llvm::slpvectorizer::addMask (SmallVectorImpl< int > &Mask, ArrayRef< int > SubMask, bool ExtendingManyInputs=false)
 Shuffles Mask in accordance with the given SubMask.
void llvm::slpvectorizer::fixupOrderingIndices (MutableArrayRef< unsigned > Order)
 Order may have elements assigned special value (size) which is out of bounds.
SmallBitVector llvm::slpvectorizer::getAltInstrMask (ArrayRef< Value * > VL, Type *ScalarTy, unsigned Opcode0, unsigned Opcode1)
SmallVector< Constant * > llvm::slpvectorizer::replicateMask (ArrayRef< Constant * > Val, unsigned VF)
 Replicates the given Val VF times.
Intrinsic::ID llvm::slpvectorizer::getMaskedDivRemIntrinsic (unsigned Opcode)
bool llvm::slpvectorizer::isOnceUsedSeed (const Instruction *I)
 Returns true if I forms a vectorizable bundle on its own and its single user does not tear the vector apart.
Instructionllvm::slpvectorizer::lookThroughCastRoundTrip (Value *V, bool MustBeElidable)
 If V is a single-use fpext of a single-use fptrunc forming a round-trip back to the type of V, returns the fptrunc; the round-trip source is its operand, always an instruction of the same type as V.
void llvm::slpvectorizer::collectNarrowedLeaves (Value *V, unsigned RdxOpcode, unsigned WideBW, unsigned MaxDepth, SmallVectorImpl< NarrowedLeafInfo > &Leaves, SmallVectorImpl< Instruction * > &ChainInsts)
 Recursively collects the narrow leaves of the widened reduction value V.
TargetTransformInfo::TargetCostKind llvm::slpvectorizer::getSLPCostKind (const Function *F)

Variables

constexpr int llvm::slpvectorizer::UsesLimit = 64
 Limit of the number of uses for potentially transformed instructions/values, used in checks to avoid compile-time explode.