@@ -543,6 +543,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
543543 void visitAliasScopeListMetadata (const MDNode *MD);
544544 void visitAccessGroupMetadata (const MDNode *MD);
545545 void visitCapturesMetadata (Instruction &I, const MDNode *Captures);
546+ void visitAllocTokenMetadata (Instruction &I, MDNode *MD);
546547
547548 template <class Ty > bool isValidMetadataArray (const MDTuple &N);
548549#define HANDLE_SPECIALIZED_MDNODE_LEAF (CLASS ) void visit##CLASS(const CLASS &N);
@@ -5395,6 +5396,12 @@ void Verifier::visitCapturesMetadata(Instruction &I, const MDNode *Captures) {
53955396 }
53965397}
53975398
5399+ void Verifier::visitAllocTokenMetadata (Instruction &I, MDNode *MD) {
5400+ Check (isa<CallBase>(I), " !alloc_token should only exist on calls" , &I);
5401+ Check (MD->getNumOperands () == 1 , " !alloc_token must have 1 operand" , MD);
5402+ Check (isa<MDString>(MD->getOperand (0 )), " expected string" , MD);
5403+ }
5404+
53985405// / verifyInstruction - Verify that an instruction is well formed.
53995406// /
54005407void Verifier::visitInstruction (Instruction &I) {
@@ -5625,6 +5632,9 @@ void Verifier::visitInstruction(Instruction &I) {
56255632 if (MDNode *Captures = I.getMetadata (LLVMContext::MD_captures))
56265633 visitCapturesMetadata (I, Captures);
56275634
5635+ if (MDNode *MD = I.getMetadata (LLVMContext::MD_alloc_token))
5636+ visitAllocTokenMetadata (I, MD);
5637+
56285638 if (MDNode *N = I.getDebugLoc ().getAsMDNode ()) {
56295639 CheckDI (isa<DILocation>(N), " invalid !dbg metadata attachment" , &I, N);
56305640 visitMDNode (*N, AreDebugLocsAllowed::Yes);
0 commit comments