Attach maximum function count to Module when using PGO mode

This sets the maximum entry count among all functions in the program to the
module using module flags. This allows the optimizer to use this information.

Differential Revision: http://reviews.llvm.org/D15163

llvm-svn: 255397
This commit is contained in:
Easwaran Raman
2015-12-12 00:31:02 +00:00
parent 8f55497264
commit d547e5e168
2 changed files with 12 additions and 0 deletions

View File

@@ -376,6 +376,9 @@ void CodeGenModule::Release() {
}
if (PGOReader && PGOStats.hasDiagnostics())
PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName);
// In PGO mode, attach maximum function count to the module.
if (PGOReader)
getModule().setMaximumFunctionCount(PGOReader->getMaximumFunctionCount());
EmitCtorList(GlobalCtors, "llvm.global_ctors");
EmitCtorList(GlobalDtors, "llvm.global_dtors");
EmitGlobalAnnotations();