mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Implement comparison operators for BranchProbability in a way that can't overflow INT64_MAX.
Add a test case for the edge case that triggers this. Thanks to Chandler for bringing this to my attention. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142794 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -71,6 +71,15 @@ TEST(BlockFrequencyTest, ProbabilityCompare) {
|
||||
EXPECT_TRUE(B > C);
|
||||
EXPECT_FALSE(B <= C);
|
||||
EXPECT_TRUE(B >= C);
|
||||
|
||||
BranchProbability BigZero(0, UINT32_MAX);
|
||||
BranchProbability BigOne(UINT32_MAX, UINT32_MAX);
|
||||
EXPECT_FALSE(BigZero == BigOne);
|
||||
EXPECT_TRUE(BigZero != BigOne);
|
||||
EXPECT_TRUE(BigZero < BigOne);
|
||||
EXPECT_FALSE(BigZero > BigOne);
|
||||
EXPECT_TRUE(BigZero <= BigOne);
|
||||
EXPECT_FALSE(BigZero >= BigOne);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user