[llvm] r335484 - [SampleFDO] Add an option to turn on/off warning about samples unused.
Wei Mi via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 25 08:40:31 PDT 2018
Author: wmi
Date: Mon Jun 25 08:40:31 2018
New Revision: 335484
URL: http://llvm.org/viewvc/llvm-project?rev=335484&view=rev
Log:
[SampleFDO] Add an option to turn on/off warning about samples unused.
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. It is not always the case. Sometimes even
if the binaries are not quite similar, we may still get some benefit by
using sampleFDO. In those cases, we may still want to apply sampleFDO but
not want to see a lot of such warnings pop up.
The patch adds an option for the warning.
Differential Revision: https://reviews.llvm.org/D48510
Modified:
llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
Modified: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp?rev=335484&r1=335483&r2=335484&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp Mon Jun 25 08:40:31 2018
@@ -111,6 +111,11 @@ static cl::opt<unsigned> SampleProfileSa
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 @@ unsigned SampleProfileLoader::getFunctio
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(
More information about the llvm-commits
mailing list