Skip to content
Merged
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
16 changes: 13 additions & 3 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,20 @@ DataFlow::DataFlow(Compiler* pCompiler)
PhaseStatus Compiler::optSetBlockWeights()
{
noway_assert(opts.OptimizationEnabled());
assert(m_dfsTree != nullptr);
const bool usingProfileWeights = fgIsUsingProfileWeights();

// Rely on profile synthesis to propagate weights when we have PGO data.
// TODO: Replace optSetBlockWeights with profile synthesis entirely.
if (usingProfileWeights)
{
// Leave breadcrumb for loop alignment
fgHasLoops = m_dfsTree->HasCycle();
return PhaseStatus::MODIFIED_NOTHING;
}

bool madeChanges = false;

assert(m_dfsTree != nullptr);
if (m_domTree == nullptr)
{
m_domTree = FlowGraphDominatorTree::Build(m_dfsTree);
Expand All @@ -59,8 +70,7 @@ PhaseStatus Compiler::optSetBlockWeights()
optFindAndScaleGeneralLoopBlocks();
}

bool firstBBDominatesAllReturns = true;
const bool usingProfileWeights = fgIsUsingProfileWeights();
bool firstBBDominatesAllReturns = true;

fgComputeReturnBlocks();

Expand Down
Loading