|
LLVM 24.0.0git
|
Helper to manage IR metadata for recipes. More...
#include "Transforms/Vectorize/VPlan.h"
Public Member Functions | |
| VPIRMetadata ()=default | |
| VPIRMetadata (Instruction &I) | |
Adds metatadata that can be preserved from the original instruction I. | |
| VPIRMetadata (const VPIRMetadata &Other)=default | |
| Copy constructor for cloning. | |
| VPIRMetadata & | operator= (const VPIRMetadata &Other)=default |
| void | applyMetadata (Instruction &I) const |
Add all metadata to I. | |
| void | setMetadata (unsigned Kind, MDNode *Node) |
Set metadata with kind Kind to Node. | |
| void | eraseMetadata (unsigned Kind) |
Remove the metadata of kind Kind, if present. | |
| void | intersect (const VPIRMetadata &MD) |
Intersect this VPIRMetadata object with MD, keeping only metadata nodes that are common to both. | |
| MDNode * | getMetadata (unsigned Kind) const |
Get metadata of kind Kind. Returns nullptr if not found. | |
| void | setExecutionFrequency (std::optional< VPExecutionFrequency > Freq, LLVMContext &Ctx) |
Record that the recipe executes with frequency Freq, relative to the entry of the loop region. | |
| std::optional< VPExecutionFrequency > | getExecutionFrequency () const |
| Returns the frequency recorded by setExecutionFrequency, if any. | |
| void | clearExecutionFrequency () |
| Drop the frequency recorded by setExecutionFrequency, if any. | |
| MDNode * | getBranchWeights () const |
| Returns the branch weights recorded for this terminator, preferring real profile data over an estimate, or nullptr if there are none. | |
| bool | hasEstimatedBranchWeights () const |
| Returns true if the weights returned by getBranchWeights are estimated. | |
| void | setEstimatedBranchWeights (MDNode *Node) |
Set estimated branch weights to Node. | |
| void | print (raw_ostream &O, VPSlotTracker &SlotTracker) const |
| Print metadata with node IDs. | |
Helper to manage IR metadata for recipes.
It filters out metadata that cannot be propagated.
|
default |
|
inline |
Adds metatadata that can be preserved from the original instruction I.
Definition at line 1213 of file VPlan.h.
References llvm::getMetadataToPropagate(), I, and llvm::isa().
|
default |
Copy constructor for cloning.
References llvm::Other, and VPIRMetadata().
| void VPIRMetadata::applyMetadata | ( | Instruction & | I | ) | const |
Add all metadata to I.
Definition at line 2190 of file VPlanRecipes.cpp.
References I.
Referenced by llvm::VPWidenIntrinsicRecipe::createVectorCall(), llvm::VPHistogramRecipe::execute(), llvm::VPInterleaveEVLRecipe::execute(), llvm::VPInterleaveRecipe::execute(), llvm::VPReplicateRecipe::execute(), llvm::VPWidenCallRecipe::execute(), llvm::VPWidenCastRecipe::execute(), llvm::VPWidenLoadEVLRecipe::execute(), llvm::VPWidenLoadRecipe::execute(), llvm::VPWidenRecipe::execute(), llvm::VPWidenStoreEVLRecipe::execute(), llvm::VPWidenStoreRecipe::execute(), and operator=().
| void VPIRMetadata::clearExecutionFrequency | ( | ) |
Drop the frequency recorded by setExecutionFrequency, if any.
Definition at line 2231 of file VPlanRecipes.cpp.
References llvm::erase_if(), and P.
Referenced by getCommonMetadata(), and mergeReplicateRegionsIntoSuccessors().
|
inline |
Remove the metadata of kind Kind, if present.
Definition at line 1245 of file VPlan.h.
References llvm::erase_if(), and P.
|
inline |
Returns the branch weights recorded for this terminator, preferring real profile data over an estimate, or nullptr if there are none.
Definition at line 1273 of file VPlan.h.
References getMetadata().
| std::optional< VPExecutionFrequency > VPIRMetadata::getExecutionFrequency | ( | ) | const |
Returns the frequency recorded by setExecutionFrequency, if any.
Definition at line 2225 of file VPlanRecipes.cpp.
References getExecutionFrequencyFromMD().
Referenced by llvm::VPReplicateRecipe::computeCost(), and mergeReplicateRegionsIntoSuccessors().
Get metadata of kind Kind. Returns nullptr if not found.
Definition at line 1254 of file VPlan.h.
References llvm::find_if(), and P.
Referenced by getBranchWeights(), and setEstimatedBranchWeights().
|
inline |
| void VPIRMetadata::intersect | ( | const VPIRMetadata & | MD | ) |
Intersect this VPIRMetadata object with MD, keeping only metadata nodes that are common to both.
Definition at line 2238 of file VPlanRecipes.cpp.
References llvm::SmallVectorImpl< T >::emplace_back(), llvm::Other, and VPIRMetadata().
Referenced by llvm::VPlanTransforms::createInterleaveGroups(), and getCommonMetadata().
|
default |
References applyMetadata(), I, llvm::Other, and VPIRMetadata().
| void VPIRMetadata::print | ( | raw_ostream & | O, |
| VPSlotTracker & | SlotTracker ) const |
Print metadata with node IDs.
Definition at line 2252 of file VPlanRecipes.cpp.
References assert(), llvm::ArrayRef< T >::empty(), llvm::extractBranchWeights(), llvm::Full, getExecutionFrequencyFromMD(), llvm::bfi_detail::BlockMass::getFull(), llvm::bfi_detail::BlockMass::getMass(), llvm::APFloatBase::IEEEdouble(), llvm::interleaveComma(), llvm::Percent, and llvm::ArrayRef< T >::size().
|
inline |
Set estimated branch weights to Node.
Definition at line 1284 of file VPlan.h.
References assert(), getMetadata(), and setMetadata().
| void VPIRMetadata::setExecutionFrequency | ( | std::optional< VPExecutionFrequency > | Freq, |
| LLVMContext & | Ctx ) |
Record that the recipe executes with frequency Freq, relative to the entry of the loop region.
Definition at line 2212 of file VPlanRecipes.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::vputils::getExecutionProbability(), llvm::Type::getInt64Ty(), llvm::ConstantInt::getTrue(), and setMetadata().
Referenced by mergeReplicateRegionsIntoSuccessors().
Set metadata with kind Kind to Node.
If metadata with Kind already exists, it will be replaced. Otherwise, it will be added.
Definition at line 1233 of file VPlan.h.
References llvm::find_if(), and P.
Referenced by setEstimatedBranchWeights(), and setExecutionFrequency().