Skip to content

Commit ec75be1

Browse files
committed
[VPlan] Assert that addMetadata does not add duplicates (NFC).
Duplicates are not supported, and would require kind-specific merging of metadata.
1 parent b4f1994 commit ec75be1

File tree

1 file changed

+5
-0
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+5
-0
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@ class VPIRMetadata {
959959

960960
/// Add metadata with kind \p Kind and \p Node.
961961
void addMetadata(unsigned Kind, MDNode *Node) {
962+
assert(none_of(Metadata,
963+
[Kind](const std::pair<unsigned, MDNode *> &P) {
964+
return P.first == Kind;
965+
}) &&
966+
"Kind must appear at most once in Metadata");
962967
Metadata.emplace_back(Kind, Node);
963968
}
964969

0 commit comments

Comments
 (0)