summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
committerpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
commit31eb748944903b7f4f38afda9851951ca9dfc1ae (patch)
tree9b95b6ea45d0874d75eb05b90c0840e191416439 /gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
parentDon't try to handle IPv4-compatible IPv6 addresses (diff)
downloadwireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.tar.xz
wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.zip
Import LLVM 5.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp')
-rw-r--r--gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp b/gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
index b3b0fcfb049..c5c9d4dea05 100644
--- a/gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
+++ b/gnu/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp
@@ -80,6 +80,14 @@ TEST_F(BlockFrequencyInfoTest, Basic) {
EXPECT_EQ(BFI.getBlockProfileCount(BB3).getValue(), UINT64_C(100));
EXPECT_EQ(BFI.getBlockProfileCount(BB1).getValue(), 100 * BB1Freq / BB0Freq);
EXPECT_EQ(BFI.getBlockProfileCount(BB2).getValue(), 100 * BB2Freq / BB0Freq);
+
+ // Scale the frequencies of BB0, BB1 and BB2 by a factor of two.
+ SmallPtrSet<BasicBlock *, 4> BlocksToScale({BB1, BB2});
+ BFI.setBlockFreqAndScale(&BB0, BB0Freq * 2, BlocksToScale);
+ EXPECT_EQ(BFI.getBlockFreq(&BB0).getFrequency(), 2 * BB0Freq);
+ EXPECT_EQ(BFI.getBlockFreq(BB1).getFrequency(), 2 * BB1Freq);
+ EXPECT_EQ(BFI.getBlockFreq(BB2).getFrequency(), 2 * BB2Freq);
+ EXPECT_EQ(BFI.getBlockFreq(BB3).getFrequency(), BB3Freq);
}
} // end anonymous namespace