Skip to content

Commit

Permalink
Do not confuse fgDispBasicBlocks in fgMorphBlocks
Browse files Browse the repository at this point in the history
The logic in "fgDispBasicBlocks" has a check for promoted implicit by-refs
that only allows them during global morph via an 'assert(fgGlobalMorph)'.
However, "fgMorphBlocks" was calling "fgDispBasicBlocks" after having set "fgGlobalMorph" to "false",
leading it to falsely believe it was not actually being called during global morph
and asserting with a message like "assertion failed 'fgGlobalMorph' - during 'Morph - Global'".
Fix this by setting "fgGlobalMorph" to "false" at the very end of "fgMorphBlocks".
  • Loading branch information
SingleAccretion committed Apr 4, 2021
1 parent 245cd97 commit 32c86dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17226,10 +17226,6 @@ void Compiler::fgMorphBlocks()
block = block->bbNext;
} while (block != nullptr);

// We are done with the global morphing phase
fgGlobalMorph = false;
compCurBB = nullptr;

// Under OSR, we no longer need to specially protect the original method entry
//
if (opts.IsOSR() && (fgEntryBB != nullptr) && (fgEntryBB->bbFlags & BBF_IMPORTED))
Expand All @@ -17247,6 +17243,10 @@ void Compiler::fgMorphBlocks()
fgDispBasicBlocks(true);
}
#endif

// We are done with the global morphing phase
fgGlobalMorph = false;
compCurBB = nullptr;
}

//------------------------------------------------------------------------
Expand Down

0 comments on commit 32c86dc

Please sign in to comment.