Skip to content

Commit

Permalink
JIT: suppress edge weight second computation pass (#46779)
Browse files Browse the repository at this point in the history
Follow up to #45615.

We compute edge weights twice. Make sure we either enable or suppress
both the computations.
  • Loading branch information
AndyAyersMS authored Jan 11, 2021
1 parent 1fb9556 commit 49a83ae
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13567,7 +13567,6 @@ void Compiler::fgComputeBlockAndEdgeWeights()
JITDUMP("*************** In fgComputeBlockAndEdgeWeights()\n");

const bool usingProfileWeights = fgIsUsingProfileWeights();
const bool isOptimizing = opts.OptimizationEnabled();

fgModified = false;
fgHaveValidEdgeWeights = false;
Expand All @@ -13592,14 +13591,7 @@ void Compiler::fgComputeBlockAndEdgeWeights()
JITDUMP(" -- no profile data, so using default called count\n");
}

if (usingProfileWeights && isOptimizing)
{
fgComputeEdgeWeights();
}
else
{
JITDUMP(" -- not optimizing or no profile data, so not computing edge weights\n");
}
fgComputeEdgeWeights();
}

//-------------------------------------------------------------
Expand Down Expand Up @@ -13806,6 +13798,15 @@ void Compiler::fgComputeCalledCount(BasicBlock::weight_t returnWeight)

void Compiler::fgComputeEdgeWeights()
{
const bool isOptimizing = opts.OptimizationEnabled();
const bool usingProfileWeights = fgIsUsingProfileWeights();

if (!isOptimizing || !usingProfileWeights)
{
JITDUMP(" -- not optimizing or no profile data, so not computing edge weights\n");
return;
}

BasicBlock* bSrc;
BasicBlock* bDst;
flowList* edge;
Expand Down

0 comments on commit 49a83ae

Please sign in to comment.