Skip to content

Commit

Permalink
JIT: fix STRESS_BB_PROFILE issue (dotnet#101925)
Browse files Browse the repository at this point in the history
Incorporate "stress" profile counts even if we're not optimizing.
Scale after synthesis, not before.

Fixes dotnet#101901.
  • Loading branch information
AndyAyersMS authored and michaelgsharp committed May 8, 2024
1 parent 1761a68 commit 4b15bab
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2846,22 +2846,14 @@ PhaseStatus Compiler::fgInstrumentMethod()
//
PhaseStatus Compiler::fgIncorporateProfileData()
{
// For now we only rely on profile data when optimizing.
//
if (!opts.OptimizationEnabled())
{
JITDUMP("not optimizing, so not incorporating any profile data\n");
return PhaseStatus::MODIFIED_NOTHING;
}

// Are we doing profile stress?
//
if (fgStressBBProf() > 0)
{
JITDUMP("JitStress -- incorporating random profile data\n");
fgIncorporateBlockCounts();
fgApplyProfileScale();
ProfileSynthesis::Run(this, ProfileSynthesisOption::RepairLikelihoods);
fgApplyProfileScale();
return PhaseStatus::MODIFIED_EVERYTHING;
}

Expand All @@ -2882,6 +2874,7 @@ PhaseStatus Compiler::fgIncorporateProfileData()
{
JITDUMP("Synthesizing profile data\n");
ProfileSynthesis::Run(this, ProfileSynthesisOption::AssignLikelihoods);
fgApplyProfileScale();
return PhaseStatus::MODIFIED_EVERYTHING;
}
}
Expand All @@ -2893,6 +2886,7 @@ PhaseStatus Compiler::fgIncorporateProfileData()
{
JITDUMP("Synthesizing profile data and writing it out as the actual profile data\n");
ProfileSynthesis::Run(this, ProfileSynthesisOption::AssignLikelihoods);
fgApplyProfileScale();
return PhaseStatus::MODIFIED_EVERYTHING;
}
#endif
Expand Down

0 comments on commit 4b15bab

Please sign in to comment.