From 695890c971f4c89da9a9d61e3b430f2e0cb49a83 Mon Sep 17 00:00:00 2001 From: Easwaran Raman Date: Thu, 17 Dec 2015 19:14:27 +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: 255918 --- clang/lib/CodeGen/CodeGenModule.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 3b3fc877bf4..173b0dcba1c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -375,8 +375,11 @@ void CodeGenModule::Release() { if (llvm::Function *CudaDtorFunction = CUDARuntime->makeModuleDtorFunction()) AddGlobalDtor(CudaDtorFunction); } - if (PGOReader && PGOStats.hasDiagnostics()) - PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName); + if (PGOReader) { + getModule().setMaximumFunctionCount(PGOReader->getMaximumFunctionCount()); + if (PGOStats.hasDiagnostics()) + PGOStats.reportDiagnostics(getDiags(), getCodeGenOpts().MainFileName); + } EmitCtorList(GlobalCtors, "llvm.global_ctors"); EmitCtorList(GlobalDtors, "llvm.global_dtors"); EmitGlobalAnnotations(); -- cgit v1.2.3