aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/IR/MetadataTest.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2015-05-13 15:13:45 +0000
committerDiego Novillo <dnovillo@google.com>2015-05-13 15:13:45 +0000
commit2567f3d0fb1f2812f99111ecd67d228ccae42c49 (patch)
tree365e1e894c459f612277ef5da02f2f53ecd2d384 /llvm/unittests/IR/MetadataTest.cpp
parentbbcf75e59eaa027251e060043067257c64a866ba (diff)
downloadllvm-2567f3d0fb1f2812f99111ecd67d228ccae42c49.zip
llvm-2567f3d0fb1f2812f99111ecd67d228ccae42c49.tar.gz
llvm-2567f3d0fb1f2812f99111ecd67d228ccae42c49.tar.bz2
Add function entry count metadata.
Summary: This adds three Function methods to handle function entry counts: setEntryCount() and getEntryCount(). Entry counts are stored under the MD_prof metadata node with the name "function_entry_count". They are unsigned 64 bit values set by profilers (instrumentation and sample profiler changes coming up). Added documentation for new profile metadata and tests. Reviewers: dexonsmith, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9628 llvm-svn: 237260
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r--llvm/unittests/IR/MetadataTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 4b35f19..baba3e5 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -2272,4 +2272,12 @@ TEST_F(FunctionAttachmentTest, Verifier) {
EXPECT_FALSE(verifyFunction(*F));
}
+TEST_F(FunctionAttachmentTest, EntryCount) {
+ Function *F = getFunction("foo");
+ EXPECT_FALSE(F->getEntryCount().hasValue());
+ F->setEntryCount(12304);
+ EXPECT_TRUE(F->getEntryCount().hasValue());
+ EXPECT_EQ(12304u, *F->getEntryCount());
+}
+
}