[PATCH] D48510: [SampleFDO] Add an option to turn on/off warning about samples unused

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 17:07:38 PDT 2018


wmi created this revision.
wmi added reviewers: danielcdh, tejohnson.
Herald added subscribers: JDevlieghere, aprantl.

If a function has sample to use, but cannot use them because of no debug information, currently a warning will be issued to inform the missing opportunity.

This warning assumes the binary generating the profile and the binary using the profile are similar enough. In some cases even if it is not similar enough, we may still get some benefit by using sampleFDO. In those cases, we may not want to see a lot of such warnings pop up.

The patch adds an option for the warning.


Repository:
  rL LLVM

https://reviews.llvm.org/D48510

Files:
  lib/Transforms/IPO/SampleProfile.cpp


Index: lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- lib/Transforms/IPO/SampleProfile.cpp
+++ lib/Transforms/IPO/SampleProfile.cpp
@@ -111,6 +111,11 @@
     cl::desc("Emit a warning if less than N% of samples in the input profile "
              "are matched to the IR."));
 
+static cl::opt<bool> NoWarnSampleUnused(
+    "no-warn-sample-unused", cl::init(false), cl::Hidden,
+    cl::desc("Use this option to turn off/on warnings about function with "
+             "samples but without debug information to use those samples. "));
+
 namespace {
 
 using BlockWeightMap = DenseMap<const BasicBlock *, uint64_t>;
@@ -1360,6 +1365,9 @@
   if (DISubprogram *S = F.getSubprogram())
     return S->getLine();
 
+  if (NoWarnSampleUnused)
+    return 0;
+
   // If the start of \p F is missing, emit a diagnostic to inform the user
   // about the missed opportunity.
   F.getContext().diagnose(DiagnosticInfoSampleProfile(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48510.152557.patch
Type: text/x-patch
Size: 984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180623/cb130e6f/attachment-0001.bin>


More information about the llvm-commits mailing list