mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[PSI] Add tests for is(Hot|Cold)FunctionInCallGraphNthPercentile.
Summary: Follow up on D75283. Also remove the test code that was moved to another test and was to be removed. Reviewers: davidxl Subscribers: eraman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75630
This commit is contained in:
parent
3df4600f3b
commit
fb601ea161
@ -240,6 +240,11 @@ TEST_F(ProfileSummaryInfoTest, InstrProf) {
|
||||
MDBuilder MDB(M->getContext());
|
||||
CI2->setMetadata(llvm::LLVMContext::MD_prof, MDB.createBranchWeights({400}));
|
||||
EXPECT_FALSE(PSI.isHotCallSite(CS2, &BFI));
|
||||
|
||||
EXPECT_TRUE(PSI.isFunctionHotInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionColdInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionHotInCallGraphNthPercentile(10000, F, BFI));
|
||||
EXPECT_TRUE(PSI.isFunctionColdInCallGraphNthPercentile(10000, F, BFI));
|
||||
}
|
||||
|
||||
TEST_F(ProfileSummaryInfoTest, InstrProfNoFuncEntryCount) {
|
||||
@ -265,6 +270,9 @@ TEST_F(ProfileSummaryInfoTest, InstrProfNoFuncEntryCount) {
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB1, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB2, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB3, &BFI));
|
||||
|
||||
EXPECT_FALSE(PSI.isFunctionHotInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionColdInCallGraphNthPercentile(990000, F, BFI));
|
||||
}
|
||||
|
||||
TEST_F(ProfileSummaryInfoTest, SampleProf) {
|
||||
@ -332,25 +340,10 @@ TEST_F(ProfileSummaryInfoTest, SampleProf) {
|
||||
CI2->setMetadata(llvm::LLVMContext::MD_prof, MDB.createBranchWeights({400}));
|
||||
EXPECT_TRUE(PSI.isHotCallSite(CS2, &BFI));
|
||||
|
||||
{
|
||||
Function *F = M->getFunction("l");
|
||||
BlockFrequencyInfo BFI = buildBFI(*F);
|
||||
BasicBlock &BB0 = F->getEntryBlock();
|
||||
BasicBlock *BB1 = BB0.getTerminator()->getSuccessor(0);
|
||||
BasicBlock *BB2 = BB0.getTerminator()->getSuccessor(1);
|
||||
BasicBlock *BB3 = BB1->getSingleSuccessor();
|
||||
|
||||
// Without the entry count, all should return false.
|
||||
EXPECT_FALSE(PSI.isHotBlockNthPercentile(990000, &BB0, &BFI));
|
||||
EXPECT_FALSE(PSI.isHotBlockNthPercentile(990000, BB1, &BFI));
|
||||
EXPECT_FALSE(PSI.isHotBlockNthPercentile(990000, BB2, &BFI));
|
||||
EXPECT_FALSE(PSI.isHotBlockNthPercentile(990000, BB3, &BFI));
|
||||
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, &BB0, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB1, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB2, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB3, &BFI));
|
||||
}
|
||||
EXPECT_TRUE(PSI.isFunctionHotInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionColdInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionHotInCallGraphNthPercentile(10000, F, BFI));
|
||||
EXPECT_TRUE(PSI.isFunctionColdInCallGraphNthPercentile(10000, F, BFI));
|
||||
}
|
||||
|
||||
TEST_F(ProfileSummaryInfoTest, SampleProfNoFuncEntryCount) {
|
||||
@ -376,6 +369,9 @@ TEST_F(ProfileSummaryInfoTest, SampleProfNoFuncEntryCount) {
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB1, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB2, &BFI));
|
||||
EXPECT_FALSE(PSI.isColdBlockNthPercentile(990000, BB3, &BFI));
|
||||
|
||||
EXPECT_FALSE(PSI.isFunctionHotInCallGraphNthPercentile(990000, F, BFI));
|
||||
EXPECT_FALSE(PSI.isFunctionColdInCallGraphNthPercentile(990000, F, BFI));
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user