Fix the bug when -compile-twice is specified, the PSI will be invalidated.
authorDehao Chen <dehao@google.com>
Wed, 28 Sep 2016 18:41:14 +0000 (18:41 +0000)
committerDehao Chen <dehao@google.com>
Wed, 28 Sep 2016 18:41:14 +0000 (18:41 +0000)
commit80c8ebb4d82ed6ee64ae77c2c49085d5b153d8f4
treef34b864eeb8566398de9e0c020fdabdebf4a2a5a
parent42cdfbcf3e92466754c175cb0e1e237e9f66749e
Fix the bug when -compile-twice is specified, the PSI will be invalidated.

Summary:
When using llc with -compile-twice, module is generated twice, but getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI will still get the old PSI with the original (invalidated) Module. This patch checks if the module has changed when calling getPSI, if yes, update the module and invalidate the Summary.
The bug does not show up in the current llc because PSI is not used in CodeGen yet. But with https://reviews.llvm.org/D24989, the bug will be exposed by test/CodeGen/PowerPC/pr26378.ll

Reviewers: eraman, davidxl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24993

llvm-svn: 282616
llvm/include/llvm/Analysis/ProfileSummaryInfo.h
llvm/lib/Analysis/ProfileSummaryInfo.cpp