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 | c9179fd2c263e1e61f90da11914ed7e020008d8e (patch) | |
tree | 791a0260fd387a7bc90fa455e283d5a38f734358 /llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp | |
parent | 00cfe279c11b83ca956ac661121db499237d2da8 (diff) | |
download | bcm5719-llvm-c9179fd2c263e1e61f90da11914ed7e020008d8e.tar.gz bcm5719-llvm-c9179fd2c263e1e61f90da11914ed7e020008d8e.zip |
[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
llvm-svn: 272891
Diffstat (limited to 'llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp')
-rw-r--r-- | llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp b/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp index b3b0fcfb049..d07b103ccb6 100644 --- a/llvm/unittests/Analysis/BlockFrequencyInfoTest.cpp +++ b/llvm/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 |