diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-14 23:13:15 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-14 23:13:15 +0000 |
commit | 6dbee00d67cc2312580615889ec153a0eecec308 (patch) | |
tree | 4082c83daf6753cc0a39ac4dbd0fd9eb1539935e /llvm/lib/IR/Verifier.cpp | |
parent | 8052238ac07dc2c4b5a3ff853f68f1cccbbf6b90 (diff) | |
download | llvm-6dbee00d67cc2312580615889ec153a0eecec308.zip llvm-6dbee00d67cc2312580615889ec153a0eecec308.tar.gz llvm-6dbee00d67cc2312580615889ec153a0eecec308.tar.bz2 |
Verifier: check that functions have at most a single !prof attachment.
llvm-svn: 272734
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 0395f5b..29550e2 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -1976,7 +1976,7 @@ void Verifier::visitFunction(const Function &F) { "blockaddress may not be used with the entry block!", Entry); } - unsigned NumDebugAttachments = 0; + unsigned NumDebugAttachments = 0, NumProfAttachments = 0; // Visit metadata attachments. for (const auto &I : MDs) { // Verify that the attachment is legal. @@ -1990,6 +1990,11 @@ void Verifier::visitFunction(const Function &F) { AssertDI(isa<DISubprogram>(I.second), "function !dbg attachment must be a subprogram", &F, I.second); break; + case LLVMContext::MD_prof: + ++NumProfAttachments; + Assert(NumProfAttachments == 1, + "function must have a single !prof attachment", &F, I.second); + break; } // Verify the metadata itself. |