[PATCH] D91673: [PGO] Enable preinline and cleanup when optimize for size

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 11:28:03 PST 2020


rnk added a comment.

Zequan, to build clang with PGO, you can follow the steps in Chrome's script to build clang with PGO:
https://source.chromium.org/chromium/chromium/src/+/master:tools/clang/scripts/build.py;l=703?q=clang%2Fscripts%2F%20build.py&ss=chromium

Regarding -Oz / minsize / SizeLevel 2, what we have discovered is that *not* running the preinliner makes the instrumented binary almost unusably large. Even if 75 is the wrong inline threshold for minsize, it's better than not running the preinliner. I think we should run with it.



================
Comment at: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp:334
   // We will not do this inline for context sensitive PGO (when IsCS is true).
-  if (OptLevel > 0 && SizeLevel == 0 && !DisablePreInliner &&
-      PGOSampleUse.empty() && !IsCS) {
+  if (OptLevel > 0 && !DisablePreInliner && PGOSampleUse.empty() && !IsCS) {
     // Create preinline pass. We construct an InlineParams object and specify
----------------
This code is duplicated for the NPM and the old PM. Please keep them in sync.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91673/new/

https://reviews.llvm.org/D91673



More information about the cfe-commits mailing list