summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData/InstrProfTest.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-12-19 18:20:09 +0000
committerXinliang David Li <davidxl@google.com>2015-12-19 18:20:09 +0000
commitc96d3d10f4b2532c9553c4374a2e58f128830cd9 (patch)
tree43f90ef9d9e6e1205cecdd959f14a8bf2e78c131 /llvm/unittests/ProfileData/InstrProfTest.cpp
parentd206d6cc5446e6b15ab1795c7d85a63a183057ab (diff)
downloadbcm5719-llvm-c96d3d10f4b2532c9553c4374a2e58f128830cd9.tar.gz
bcm5719-llvm-c96d3d10f4b2532c9553c4374a2e58f128830cd9.zip
Improve InstrProfSymtab test coverage
llvm-svn: 256099
Diffstat (limited to 'llvm/unittests/ProfileData/InstrProfTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/InstrProfTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index 994f75502d9..f5ff31516c5 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -546,6 +546,33 @@ TEST_F(InstrProfTest, instr_prof_symtab_test) {
ASSERT_EQ(StringRef("bar2"), R);
R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("bar3"));
ASSERT_EQ(StringRef("bar3"), R);
+
+ // Now incrementally update the symtab
+ Symtab.addFuncName("blah_1");
+ Symtab.addFuncName("blah_2");
+ Symtab.addFuncName("blah_3");
+ // Finalize it
+ Symtab.finalizeSymtab();
+
+ // Check again
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("blah_1"));
+ ASSERT_EQ(StringRef("blah_1"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("blah_2"));
+ ASSERT_EQ(StringRef("blah_2"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("blah_3"));
+ ASSERT_EQ(StringRef("blah_3"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("func1"));
+ ASSERT_EQ(StringRef("func1"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("func2"));
+ ASSERT_EQ(StringRef("func2"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("func3"));
+ ASSERT_EQ(StringRef("func3"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("bar1"));
+ ASSERT_EQ(StringRef("bar1"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("bar2"));
+ ASSERT_EQ(StringRef("bar2"), R);
+ R = Symtab.getFuncName(IndexedInstrProf::ComputeHash("bar3"));
+ ASSERT_EQ(StringRef("bar3"), R);
}
} // end anonymous namespace
OpenPOWER on IntegriCloud