diff options
author | Igor Laevsky <igmyrj@gmail.com> | 2016-06-16 13:28:25 +0000 |
---|---|---|
committer | Igor Laevsky <igmyrj@gmail.com> | 2016-06-16 13:28:25 +0000 |
commit | 5695246406d16aff443f93ee4d761a76f0608f68 (patch) | |
tree | 0fc45ad4049458efe3740cde42d9df2fe8c16c22 /unittests | |
parent | 7d0c87865097a8290a5e0718a89d353d8e9a0c1c (diff) |
[JumpThreading] Prevent dangling pointer problems in BranchProbabilityInfo
We should update results of the BranchProbabilityInfo after removing block in JumpThreading. Otherwise
we will get dangling pointer inside BranchProbabilityInfo cache.
Differential Revision: http://reviews.llvm.org/D20957
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Analysis/BlockFrequencyInfoTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/Analysis/BlockFrequencyInfoTest.cpp b/unittests/Analysis/BlockFrequencyInfoTest.cpp index b3b0fcfb049..d07b103ccb6 100644 --- a/unittests/Analysis/BlockFrequencyInfoTest.cpp +++ b/unittests/Analysis/BlockFrequencyInfoTest.cpp @@ -54,6 +54,11 @@ protected: SMDiagnostic Err; return parseAssemblyString(ModuleStrig, Err, C); } + + void destroyBFI() { + // Prevent AssertingVH from failing. + BPI->releaseMemory(); + } }; TEST_F(BlockFrequencyInfoTest, Basic) { @@ -80,6 +85,8 @@ 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); + + destroyBFI(); } } // end anonymous namespace |