class BoUpSLP::VLOperands
Declaration
class BoUpSLP::VLOperands { /* full declaration omitted */ };
Description
A helper data structure to hold the operands of a vector of instructions. This supports a fixed vector length for all operand vectors.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1323
Member Variables
- private SmallVector<llvm::slpvectorizer::BoUpSLP:: VLOperands::OperandDataVec, 4> OpsVec
- A vector of operand vectors.
- private const llvm::DataLayout& DL
- private llvm::ScalarEvolution& SE
- private const llvm::slpvectorizer::BoUpSLP& R
- private SmallDenseMap< std::pair<unsigned int, unsigned int>, unsigned int, 8> BestScoresPerLanes
- Best defined scores per lanes between the passes. Used to choose the best operand (with the highest score) between the passes. The key - {Operand Index, Lane}. The value - the best score between the passes for the lane and the operand.
- private static const int ScoreScaleFactor = 10
- Score scaling factor for fully compatible instructions but with different number of external uses. Allows better selection of the instructions with less external uses.
Method Overview
- public VLOperands(ArrayRef<llvm::Value *> RootVL, const llvm::DataLayout & DL, llvm::ScalarEvolution & SE, const llvm::slpvectorizer::BoUpSLP & R)
- private void appendOperandsOfVL(ArrayRef<llvm::Value *> VL)
- private void clear()
- private void clearUsed()
- public void dump() const
- public static void dumpMode(llvm::slpvectorizer::BoUpSLP::VLOperands::ReorderingMode RMode)
- private bool empty() const
- private unsigned int getBestLaneToStartReordering() const
- private Optional<unsigned int> getBestOperand(unsigned int OpIdx, int Lane, int LastLane, ArrayRef<llvm::slpvectorizer::BoUpSLP::VLOperands::ReorderingMode> ReorderingModes, ArrayRef<llvm::Value *> MainAltOps)
- private const llvm::slpvectorizer::BoUpSLP::VLOperands::OperandData & getData(unsigned int OpIdx, unsigned int Lane) const
- private llvm::slpvectorizer::BoUpSLP::VLOperands::OperandData & getData(unsigned int OpIdx, unsigned int Lane)
- private int getExternalUseScore(unsigned int Lane, unsigned int OpIdx, unsigned int Idx) const
- private int getLookAheadScore(llvm::Value * LHS, llvm::Value * RHS, ArrayRef<llvm::Value *> MainAltOps, int Lane, unsigned int OpIdx, unsigned int Idx, bool & IsUsed)
- private llvm::slpvectorizer::BoUpSLP::VLOperands::OperandsOrderData getMaxNumOperandsThatCanBeReordered(unsigned int Lane) const
- public static llvm::StringRef getModeStr(llvm::slpvectorizer::BoUpSLP::VLOperands::ReorderingMode RMode)
- private unsigned int getNumLanes() const
- private unsigned int getNumOperands() const
- private int getSplatScore(unsigned int Lane, unsigned int OpIdx, unsigned int Idx) const
- public llvm::slpvectorizer::BoUpSLP::ValueList getVL(unsigned int OpIdx) const
- private llvm::Value * getValue(unsigned int OpIdx, unsigned int Lane) const
- public llvm::raw_ostream & print(llvm::raw_ostream & OS) const
- public static llvm::raw_ostream & printMode(llvm::slpvectorizer::BoUpSLP::VLOperands::ReorderingMode RMode, llvm::raw_ostream & OS)
- public void reorder()
- private bool shouldBroadcast(llvm::Value * Op, unsigned int OpIdx, unsigned int Lane)
- private void swap(unsigned int OpIdx1, unsigned int OpIdx2, unsigned int Lane)
Methods
¶VLOperands(ArrayRef<llvm::Value*> RootVL,
const llvm::DataLayout& DL,
llvm::ScalarEvolution& SE,
const llvm::slpvectorizer::BoUpSLP& R)
VLOperands(ArrayRef<llvm::Value*> RootVL,
const llvm::DataLayout& DL,
llvm::ScalarEvolution& SE,
const llvm::slpvectorizer::BoUpSLP& R)
Description
Initialize with all the operands of the instruction vector \p RootVL.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1809
Parameters
- ArrayRef<llvm::Value*> RootVL
- const llvm::DataLayout& DL
- llvm::ScalarEvolution& SE
- const llvm::slpvectorizer::BoUpSLP& R
¶void appendOperandsOfVL(ArrayRef<llvm::Value*> VL)
void appendOperandsOfVL(ArrayRef<llvm::Value*> VL)
Description
Go through the instructions in VL and append their operands.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1734
Parameters
- ArrayRef<llvm::Value*> VL
¶void clear()
void clear()
Description
Clears the data.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1779
¶void clearUsed()
void clearUsed()
Description
Clears the used flag for all entries.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1399
¶void dump() const
void dump() const
Description
Debug print.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2015
¶static void dumpMode(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode)
static void dumpMode(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode)
Description
Debug print.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1988
Parameters
- llvm::slpvectorizer::BoUpSLP::VLOperands:: ReorderingMode RMode
¶bool empty() const
bool empty() const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1776
Returns
true if the data structure is empty.
¶unsigned int getBestLaneToStartReordering() const
unsigned int getBestLaneToStartReordering() const
Description
Helper for reorderOperandVecs.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1611
Returns
the lane that we should start reordering from. This is the one which has the least number of operands that can freely move about or less profitable because it already has the most optimal set of operands.
¶Optional<unsigned int> getBestOperand(
unsigned int OpIdx,
int Lane,
int LastLane,
ArrayRef<llvm::slpvectorizer::BoUpSLP::
VLOperands::ReorderingMode>
ReorderingModes,
ArrayRef<llvm::Value*> MainAltOps)
Optional<unsigned int> getBestOperand(
unsigned int OpIdx,
int Lane,
int LastLane,
ArrayRef<llvm::slpvectorizer::BoUpSLP::
VLOperands::ReorderingMode>
ReorderingModes,
ArrayRef<llvm::Value*> MainAltOps)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1524
Parameters
- unsigned int OpIdx
- int Lane
- int LastLane
- ArrayRef<llvm::slpvectorizer::BoUpSLP:: VLOperands::ReorderingMode> ReorderingModes
- ArrayRef<llvm::Value*> MainAltOps
¶const llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandData&
getData(unsigned int OpIdx,
unsigned int Lane) const
const llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandData&
getData(unsigned int OpIdx,
unsigned int Lane) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1394
Parameters
- unsigned int OpIdx
- unsigned int Lane
Returns
the operand data at \p OpIdx and \p Lane. Const version.
¶llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandData&
getData(unsigned int OpIdx, unsigned int Lane)
llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandData&
getData(unsigned int OpIdx, unsigned int Lane)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1389
Parameters
- unsigned int OpIdx
- unsigned int Lane
Returns
the operand data at \p OpIdx and \p Lane.
¶int getExternalUseScore(unsigned int Lane,
unsigned int OpIdx,
unsigned int Idx) const
int getExternalUseScore(unsigned int Lane,
unsigned int OpIdx,
unsigned int Idx) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1453
Parameters
- unsigned int Lane
- lane of the operands under analysis.
- unsigned int OpIdx
- operand index in \p Lane lane we're looking the best candidate for.
- unsigned int Idx
- operand index of the current candidate value.
Returns
The additional score for the scalar which users are all vectorized.
¶int getLookAheadScore(
llvm::Value* LHS,
llvm::Value* RHS,
ArrayRef<llvm::Value*> MainAltOps,
int Lane,
unsigned int OpIdx,
unsigned int Idx,
bool& IsUsed)
int getLookAheadScore(
llvm::Value* LHS,
llvm::Value* RHS,
ArrayRef<llvm::Value*> MainAltOps,
int Lane,
unsigned int OpIdx,
unsigned int Idx,
bool& IsUsed)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1482
Parameters
- llvm::Value* LHS
- llvm::Value* RHS
- ArrayRef<llvm::Value*> MainAltOps
- int Lane
- unsigned int OpIdx
- unsigned int Idx
- bool& IsUsed
Returns
the look-ahead score, which tells us how much the sub-trees rooted at \p LHS and \p RHS match, the more they match the higher the score. This helps break ties in an informed way when we cannot decide on the order of the operands by just considering the immediate predecessors.
¶llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandsOrderData
getMaxNumOperandsThatCanBeReordered(
unsigned int Lane) const
llvm::slpvectorizer::BoUpSLP::VLOperands::
OperandsOrderData
getMaxNumOperandsThatCanBeReordered(
unsigned int Lane) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1683
Parameters
- unsigned int Lane
Returns
the maximum number of operands that are allowed to be reordered for \p Lane and the number of compatible instructions(with the same parent/opcode). This is used as a heuristic for selecting the first lane to start operand reordering.
¶static llvm::StringRef getModeStr(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode)
static llvm::StringRef getModeStr(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1966
Parameters
- llvm::slpvectorizer::BoUpSLP::VLOperands:: ReorderingMode RMode
¶unsigned int getNumLanes() const
unsigned int getNumLanes() const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1768
Returns
the number of lanes.
¶unsigned int getNumOperands() const
unsigned int getNumOperands() const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1765
Returns
the number of operands.
¶int getSplatScore(unsigned int Lane,
unsigned int OpIdx,
unsigned int Idx) const
int getSplatScore(unsigned int Lane,
unsigned int OpIdx,
unsigned int Idx) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1421
Parameters
- unsigned int Lane
- lane of the operands under analysis.
- unsigned int OpIdx
- operand index in \p Lane lane we're looking the best candidate for.
- unsigned int Idx
- operand index of the current candidate value.
Returns
The additional score due to possible broadcasting of the elements in the lane. It is more profitable to have power-of-2 unique elements in the lane, it will be vectorized with higher probability after removing duplicates. Currently the SLP vectorizer supports only vectorization of the power-of-2 number of unique scalars.
¶llvm::slpvectorizer::BoUpSLP::ValueList getVL(
unsigned int OpIdx) const
llvm::slpvectorizer::BoUpSLP::ValueList getVL(
unsigned int OpIdx) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1818
Parameters
- unsigned int OpIdx
Returns
a value vector with the operands across all lanes for the opearnd at \p OpIdx.
¶llvm::Value* getValue(unsigned int OpIdx,
unsigned int Lane) const
llvm::Value* getValue(unsigned int OpIdx,
unsigned int Lane) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1771
Parameters
- unsigned int OpIdx
- unsigned int Lane
Returns
the operand value at \p OpIdx and \p Lane.
¶llvm::raw_ostream& print(
llvm::raw_ostream& OS) const
llvm::raw_ostream& print(
llvm::raw_ostream& OS) const
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1996
Parameters
¶static llvm::raw_ostream& printMode(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode,
llvm::raw_ostream& OS)
static llvm::raw_ostream& printMode(
llvm::slpvectorizer::BoUpSLP::VLOperands::
ReorderingMode RMode,
llvm::raw_ostream& OS)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1982
Parameters
- llvm::slpvectorizer::BoUpSLP::VLOperands:: ReorderingMode RMode
- llvm::raw_ostream& OS
¶void reorder()
void reorder()
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1830
¶bool shouldBroadcast(llvm::Value* Op,
unsigned int OpIdx,
unsigned int Lane)
bool shouldBroadcast(llvm::Value* Op,
unsigned int OpIdx,
unsigned int Lane)
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1784
Parameters
- llvm::Value* Op
- unsigned int OpIdx
- unsigned int Lane
Returns
true if there are enough operands identical to \p Op to fill the whole vector. Note: This modifies the 'IsUsed' flag, so a cleanUsed() must follow.
¶void swap(unsigned int OpIdx1,
unsigned int OpIdx2,
unsigned int Lane)
void swap(unsigned int OpIdx1,
unsigned int OpIdx2,
unsigned int Lane)
Description
Swap the operand at \p OpIdx1 with that one at \p OpIdx2.
Declared at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1408
Parameters
- unsigned int OpIdx1
- unsigned int OpIdx2
- unsigned int Lane