From 0ef7c0bdfaad3c5e46e47922341b390a52b8dc79 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Fri, 24 Mar 2017 15:42:04 -0700 Subject: [PATCH] Fix for JitStress test failures --- src/jit/flowgraph.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 08b0fa8..4c414f6 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -12699,14 +12699,21 @@ void Compiler::fgComputeEdgeWeights() // Did we allocate a scratch block as the new first BB? if (fgFirstBBisScratch()) { - firstILBlock = firstILBlock->bbNext; - // The second block is expected to have a profile-derived weight + // Skip past any/all BBF_INTERNAL blocks that may have been added before the first real IL block. + // These internal blocks all should be BBJ_NONE blocks. + // + while (firstILBlock->bbFlags & BBF_INTERNAL) + { + assert(firstILBlock->bbJumpKind == BBJ_NONE); + firstILBlock = firstILBlock->bbNext; + } + // The 'firstILBlock' is now expected to have a profile-derived weight assert(firstILBlock->hasProfileWeight()); } - // If the first block only has one ref then we use it's weight - // for fgCalledCount. Otherwise we have backedge's into the first block, - // so instead we use the sum of the return block weights for fgCalledCount. + // If the first block only has one ref then we use it's weight for fgCalledCount. + // Otherwise we have backedge's into the first block, so instead we use the sum + // of the return block weights for fgCalledCount. // // If the profile data has a 0 for the returnWeight // (i.e. the function never returns because it always throws) -- 2.7.4