diff options
| author | Wei Mi <wmi@google.com> | 2018-06-25 15:40:31 +0000 |
|---|---|---|
| committer | Wei Mi <wmi@google.com> | 2018-06-25 15:40:31 +0000 |
| commit | e5551274354ade49423fb004943b412b8554944d (patch) | |
| tree | 535547543860e66734d6e3d33041977ef540a2e4 /llvm/lib/Transforms | |
| parent | 96edb2e37e7614be21e52504c1246c96b6e5f65d (diff) | |
| download | bcm5719-llvm-e5551274354ade49423fb004943b412b8554944d.tar.gz bcm5719-llvm-e5551274354ade49423fb004943b412b8554944d.zip | |
[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
llvm-svn: 335484
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 357a7d1148c..dcd24595f7e 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -111,6 +111,11 @@ static cl::opt<unsigned> SampleProfileSampleCoverage( 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::getFunctionLoc(Function &F) { 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( |

