From d547e5e16842f13b4c78eb942d349c8f1c553148 Mon Sep 17 00:00:00 2001 From: Easwaran Raman Date: Sat, 12 Dec 2015 00:31:02 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 29c5f3eed5a..8d7254904a9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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(); -- cgit v1.2.3