Index: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp +++ llvm/trunk/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 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; @@ -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(