23 MDNode *MD =
I.getMetadata(LLVMContext::MD_mem_cache_hint);
36 if (
MDNode *MD =
I.getMetadata(LLVMContext::MD_mem_cache_hint))
37 for (
unsigned Idx = 0; Idx + 1 < MD->getNumOperands(); Idx += 2)
43 [](
const auto &Entry,
unsigned OperandNo) {
44 return Entry.first < OperandNo;
46 if (It != Entries.
end() && It->first == OperandNo) {
52 Entries.
insert(It, {OperandNo, Hint});
58 for (
const auto &[Index, Payload] : Entries) {
63 I.setMetadata(LLVMContext::MD_mem_cache_hint,
78 switch (
II->getIntrinsicID()) {
79 case Intrinsic::masked_load:
80 case Intrinsic::masked_gather:
82 case Intrinsic::masked_store:
83 case Intrinsic::masked_scatter:
93 if (!PointerIndex || Sources.
empty())
99 MDNode *MD =
First->getMetadata(LLVMContext::MD_mem_cache_hint);
103 for (
Value *
V : Sources) {
106 Source->getMetadata(LLVMContext::MD_mem_cache_hint) != MD)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static MDNode * getCommonCacheHint(const Instruction &Dest, ArrayRef< Value * > Sources)
static std::optional< unsigned > getPointerOperandIndex(const Instruction &I)
uint64_t IntrinsicInst * II
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
Get the first element.
bool empty() const
Check if the array is empty.
LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
static unsigned getPointerOperandIndex()
const MDOperand & getOperand(unsigned I) const
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
unsigned getNumOperands() const
Return number of MDNode operands.
reference emplace_back(ArgTypes &&... Args)
iterator erase(const_iterator CI)
iterator insert(iterator I, T &&Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static unsigned getPointerOperandIndex()
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM Value Representation.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void setMemCacheHint(Instruction &I, unsigned OperandNo, MDNode *Hint)
Set the hint payload for operand OperandNo of I, preserving other operands' hints.
LLVM_ABI void propagateMemCacheHint(Instruction &Dest, ArrayRef< Value * > Sources)
Copy identical source cache-hint attachments to Dest, or clear its attachment if propagation fails.
LLVM_ABI MDNode * getMemCacheHint(const Instruction &I, unsigned OperandNo=0)
Return the hint payload for operand OperandNo of I, or nullptr if absent.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.