|
LLVM 23.0.0git
|
Merges shuffle masks and emits final shuffle instruction, if required. More...
Public Member Functions | |
| ShuffleInstructionBuilder (Type *ScalarTy, IRBuilderBase &Builder, BoUpSLP &R) | |
| Value * | adjustExtracts (const TreeEntry *E, MutableArrayRef< int > Mask, ArrayRef< std::optional< TTI::ShuffleKind > > ShuffleKinds, unsigned NumParts, bool &UseVecBaseAsInput) |
| Adjusts extractelements after reusing them. | |
| std::optional< Value * > | needToDelay (const TreeEntry *E, ArrayRef< SmallVector< const TreeEntry * > > Deps) const |
Checks if the specified entry E needs to be delayed because of its dependency nodes. | |
| void | resetForSameNode () |
| Reset the builder to handle perfect diamond match. | |
| void | add (const TreeEntry &E1, const TreeEntry &E2, ArrayRef< int > Mask) |
| Adds 2 input vectors (in form of tree entries) and the mask for their shuffling. | |
| void | add (const TreeEntry &E1, ArrayRef< int > Mask) |
| Adds single input vector (in form of tree entry) and the mask for its shuffling. | |
| void | add (Value *V1, Value *V2, ArrayRef< int > Mask) |
| Adds 2 input vectors and the mask for their shuffling. | |
| void | add (Value *V1, ArrayRef< int > Mask, bool=false) |
| Adds another one input vector and the mask for the shuffling. | |
| void | addOrdered (Value *V1, ArrayRef< unsigned > Order) |
| Adds another one input vector and the mask for the shuffling. | |
| Value * | gather (ArrayRef< Value * > VL, unsigned MaskVF=0, Value *Root=nullptr) |
| Value * | createFreeze (Value *V) |
| Value * | finalize (ArrayRef< int > ExtMask, ArrayRef< std::pair< const TreeEntry *, unsigned > > SubVectors, ArrayRef< int > SubVectorsMask, unsigned VF=0, function_ref< void(Value *&, SmallVectorImpl< int > &, function_ref< Value *(Value *, Value *, ArrayRef< int >)>)> Action={}) |
| Finalize emission of the shuffles. | |
| ~ShuffleInstructionBuilder () | |
Merges shuffle masks and emits final shuffle instruction, if required.
It supports shuffling of 2 input vectors. It implements lazy shuffles emission, when the actual shuffle instruction is generated only if this is actually required. Otherwise, the shuffle instruction emission is delayed till the end of the process, to reduce the number of emitted instructions and further analysis/transformations. The class also will look through the previously emitted shuffle instructions and properly mark indices in mask as undef. For example, given the code
and if need to emit shuffle of s1 and s2 with mask <1, 0, 3, 2>, it will look through s1 and s2 and emit
instead. If 2 operands are of different size, the smallest one will be resized and the mask recalculated properly. For example, given the code
and if need to emit shuffle of s1 and s2 with mask <1, 0, 5, 4>, it will look through s1 and s2 and emit
instead.
Definition at line 21965 of file SLPVectorizer.cpp.
|
inline |
Definition at line 22102 of file SLPVectorizer.cpp.
References slpvectorizer::BoUpSLP::BoUpSLP().
|
inline |
Definition at line 22496 of file SLPVectorizer.cpp.
References assert().
|
inline |
Adds single input vector (in form of tree entry) and the mask for its shuffling.
Definition at line 22283 of file SLPVectorizer.cpp.
|
inline |
Adds 2 input vectors (in form of tree entries) and the mask for their shuffling.
Definition at line 22276 of file SLPVectorizer.cpp.
References add(), and llvm::V1.
Referenced by add(), add(), and addOrdered().
|
inline |
Adds another one input vector and the mask for the shuffling.
Definition at line 22322 of file SLPVectorizer.cpp.
References assert(), llvm::cast(), llvm::find(), llvm::isa(), llvm::PoisonMaskElem, and llvm::V1.
|
inline |
Adds 2 input vectors and the mask for their shuffling.
Definition at line 22288 of file SLPVectorizer.cpp.
References assert(), llvm::cast(), llvm::Value::getType(), llvm::isa(), llvm::PoisonMaskElem, and llvm::V1.
|
inline |
Adds another one input vector and the mask for the shuffling.
Definition at line 22375 of file SLPVectorizer.cpp.
References add(), inversePermutation(), and llvm::V1.
|
inline |
Adjusts extractelements after reusing them.
Definition at line 22106 of file SLPVectorizer.cpp.
References llvm::any_of(), assert(), llvm::cast(), llvm::count(), llvm::count_if(), llvm::ArrayRef< T >::empty(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isa(), llvm::PoisonMaskElem, and reorderScalars().
Definition at line 22387 of file SLPVectorizer.cpp.
|
inline |
Finalize emission of the shuffles.
| Action | the action (if any) to be performed before final applying of the ExtMask mask. |
Definition at line 22391 of file SLPVectorizer.cpp.
|
inline |
Definition at line 22380 of file SLPVectorizer.cpp.
References llvm::V1.
|
inline |
Checks if the specified entry E needs to be delayed because of its dependency nodes.
Definition at line 22252 of file SLPVectorizer.cpp.
References llvm::all_of(), llvm::PoisonValue::get(), llvm::PointerType::getUnqual(), and getWidenedType().
|
inline |
Reset the builder to handle perfect diamond match.
Definition at line 22269 of file SLPVectorizer.cpp.