Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6479,6 +6479,7 @@ class Compiler
bool fgPgoSynthesized;
bool fgPgoDynamic;
bool fgPgoConsistent;
bool fgPgoSingleEdge = false;

#ifdef DEBUG
bool fgPgoDeferredInconsistency;
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ bool Compiler::fgHaveSufficientProfileWeights()
case ICorJitInfo::PgoSource::Blend:
return true;

case ICorJitInfo::PgoSource::Synthesis:
// Single-edge methods always have sufficient profile data.
// Assuming we don't synthesize value and class profile data (which we don't currently).
return fgPgoSingleEdge;

case ICorJitInfo::PgoSource::Static:
{
// We sometimes call this very early, eg evaluating the prejit root.
Expand Down Expand Up @@ -134,6 +139,12 @@ bool Compiler::fgHaveTrustedProfileWeights()
case ICorJitInfo::PgoSource::Blend:
case ICorJitInfo::PgoSource::Text:
return true;

case ICorJitInfo::PgoSource::Synthesis:
// Single-edge methods with synthetic profile are trustful.
// Assuming we don't synthesize value and class profile data (which we don't currently).
return fgPgoSingleEdge;

default:
return false;
}
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/jit/fgprofilesynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ void ProfileSynthesis::Run(ProfileSynthesisOption option)
m_comp->fgPgoSynthesized = true;
m_comp->fgPgoConsistent = !m_approximate;

// A simple check whether the current method has more than one edge.
m_comp->fgPgoSingleEdge = true;
for (BasicBlock* const block : m_comp->Blocks())
{
if (block->NumSucc() > 1)
{
m_comp->fgPgoSingleEdge = false;
break;
}
}

m_comp->Metrics.ProfileSynthesizedBlendedOrRepaired++;

if (m_approximate)
Expand Down
Loading