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
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
not sure how to test this: it requires -compile-twice, which is an llc flag, but llc does not use PSI for now. https://reviews.llvm.org/D24989 will be the first patch that makes llc uses PSI.
Comment Actions
This sounds like not very idiomatic. I believe the usual solution is to handle this inside doInitialization. Can you clarify why you didn't do it this way?
Comment Actions
You are right, doInitialization indeed made the analysis impl more cleaner. A fix is sent out in https://reviews.llvm.org/D25041
Thanks
resetModule