diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -2048,6 +2048,12 @@ UsePreInlinerDecision = true; } + // Enable stale profile matching by default for CSSPGO. + if (Reader->profileIsProbeBased()) { + if (!SalvageStaleProfile.getNumOccurrences()) + SalvageStaleProfile = true; + } + if (!Reader->profileIsCS()) { // Non-CS profile should be fine without a function size budget for the // inliner since the contexts in the profile are either all from inlining