Add compare operators to BranchProbability and use it to determine if an edge is hot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2011-10-23 11:19:14 +00:00
parent 3071363bcd
commit 341473c86d
4 changed files with 40 additions and 17 deletions

View File

@ -53,4 +53,24 @@ TEST(BlockFrequencyTest, MaxToMax) {
EXPECT_EQ(Freq.getFrequency(), UINT64_MAX);
}
TEST(BlockFrequencyTest, ProbabilityCompare) {
BranchProbability A(4, 5);
BranchProbability B(4U << 29, 5U << 29);
BranchProbability C(3, 4);
EXPECT_TRUE(A == B);
EXPECT_FALSE(A != B);
EXPECT_FALSE(A < B);
EXPECT_FALSE(A > B);
EXPECT_TRUE(A <= B);
EXPECT_TRUE(A >= B);
EXPECT_FALSE(B == C);
EXPECT_TRUE(B != C);
EXPECT_FALSE(B < C);
EXPECT_TRUE(B > C);
EXPECT_FALSE(B <= C);
EXPECT_TRUE(B >= C);
}
}