[PATCH] D129565: [NFC][Metadata] Change MDNode::operands()'s return type from op_range to ArrayRef<MDOperand>
Dawid Jurczak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 08:23:17 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd71128d97df9: [NFC][Metadata] Change MDNode::operands()'s return type from op_range to… (authored by yurai007).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129565/new/
https://reviews.llvm.org/D129565
Files:
llvm/include/llvm/IR/Metadata.h
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/lib/Linker/IRMover.cpp
Index: llvm/lib/Linker/IRMover.cpp
===================================================================
--- llvm/lib/Linker/IRMover.cpp
+++ llvm/lib/Linker/IRMover.cpp
@@ -1362,8 +1362,10 @@
"Expected MDTuple when appending module flags");
if (DstValue->isDistinct())
return dyn_cast<MDTuple>(DstValue);
+ ArrayRef<MDOperand> DstOperands = DstValue->operands();
MDTuple *New = MDTuple::getDistinct(
- DstM.getContext(), SmallVector<Metadata *, 4>(DstValue->operands()));
+ DstM.getContext(),
+ SmallVector<Metadata *, 4>(DstOperands.begin(), DstOperands.end()));
Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New};
MDNode *Flag = MDTuple::getDistinct(DstM.getContext(), FlagOps);
DstModFlags->setOperand(DstIndex, Flag);
Index: llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -303,7 +303,7 @@
/// given offset. Update the offset to be relative to the field type.
TBAAStructTypeNode getField(uint64_t &Offset) const {
bool NewFormat = isNewFormat();
- const ArrayRef<MDOperand> Operands(Node->op_begin(), Node->op_end());
+ const ArrayRef<MDOperand> Operands = Node->operands();
const unsigned NumOperands = Operands.size();
if (NewFormat) {
@@ -811,7 +811,8 @@
return nullptr;
// Otherwise, create TBAA with the new Len
- SmallVector<Metadata *, 4> NextNodes(MD->operands());
+ ArrayRef<MDOperand> MDOperands = MD->operands();
+ SmallVector<Metadata *, 4> NextNodes(MDOperands.begin(), MDOperands.end());
ConstantInt *PreviousSize = mdconst::extract<ConstantInt>(NextNodes[3]);
// Don't create a new MDNode if it is the same length.
Index: llvm/include/llvm/IR/Metadata.h
===================================================================
--- llvm/include/llvm/IR/Metadata.h
+++ llvm/include/llvm/IR/Metadata.h
@@ -1287,7 +1287,7 @@
return const_cast<MDNode *>(this)->mutable_end();
}
- op_range operands() const { return op_range(op_begin(), op_end()); }
+ ArrayRef<MDOperand> operands() const { return getHeader().operands(); }
const MDOperand &getOperand(unsigned I) const {
assert(I < getNumOperands() && "Out of range");
@@ -1345,7 +1345,9 @@
StorageType Storage, bool ShouldCreate = true);
TempMDTuple cloneImpl() const {
- return getTemporary(getContext(), SmallVector<Metadata *, 4>(operands()));
+ ArrayRef<MDOperand> Operands = operands();
+ return getTemporary(getContext(), SmallVector<Metadata *, 4>(
+ Operands.begin(), Operands.end()));
}
public:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129565.444677.patch
Type: text/x-patch
Size: 2781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/096662c4/attachment.bin>
More information about the llvm-commits
mailing list