From: Brian Sullivan Date: Fri, 24 Mar 2017 22:42:04 +0000 (-0700) Subject: Fix for JitStress test failures X-Git-Tag: submit/tizen/20210909.063632~11030^2~7555^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03431c4359d2e37b395753fee9997381c86ed455;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix for JitStress test failures Commit migrated from https://github.com/dotnet/coreclr/commit/0ef7c0bdfaad3c5e46e47922341b390a52b8dc79 --- diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 08b0fa8..4c414f6 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/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)