[PATCH] D15163: Attach maximum function count to Module when using PGO mode.

Easwaran Raman via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 11 16:34:06 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255397: Attach maximum function count to Module when using PGO mode (authored by eraman).

Changed prior to commit:
  http://reviews.llvm.org/D15163?vs=42549&id=42604#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15163

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/test/CodeGen/pgo-max-function-count.c

Index: cfe/trunk/test/CodeGen/pgo-max-function-count.c
===================================================================
--- cfe/trunk/test/CodeGen/pgo-max-function-count.c
+++ cfe/trunk/test/CodeGen/pgo-max-function-count.c
@@ -0,0 +1,9 @@
+// RUN: %clang -fprofile-generate -o %t -O2 %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw  %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: %clang -fprofile-use=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
+// Check
+int main() {
+  return 0;
+}
+// CHECK: !{{[0-9]+}} = !{i32 1, !"MaxFunctionCount", i32 1}
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -376,6 +376,9 @@
   }
   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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15163.42604.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151212/431f2d3e/attachment-0001.bin>


More information about the cfe-commits mailing list