Skip to content

Commit

Permalink
JIT: run remorph stress before fgRemoveDeadBlocks (#68420)
Browse files Browse the repository at this point in the history
Since the former may want to consult reachability sets and the latter may
render them invalid.

Also move the point at which we globally disable dominators up since they
are also no longer valid after `fgRemoveDeadBlocks`.

Fixes #68306.
Fixes #67871.
  • Loading branch information
AndyAyersMS committed Apr 24, 2022
1 parent c82e8b2 commit a9f9745
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/coreclr/jit/compiler.cpp
Expand Up @@ -4972,9 +4972,17 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
}
}

#ifdef DEBUG
// Run this before we potentially tear down dominators.
fgDebugCheckLinks(compStressCompile(STRESS_REMORPH_TREES, 50));
#endif

// Remove dead blocks
DoPhase(this, PHASE_REMOVE_DEAD_BLOCKS, &Compiler::fgRemoveDeadBlocks);

// Dominator and reachability sets are no longer valid.
fgDomsComputed = false;

// Insert GC Polls
DoPhase(this, PHASE_INSERT_GC_POLLS, &Compiler::fgInsertGCPolls);

Expand All @@ -4983,8 +4991,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
DoPhase(this, PHASE_DETERMINE_FIRST_COLD_BLOCK, &Compiler::fgDetermineFirstColdBlock);

#ifdef DEBUG
fgDebugCheckLinks(compStressCompile(STRESS_REMORPH_TREES, 50));

// Stash the current estimate of the function's size if necessary.
if (verbose)
{
Expand Down Expand Up @@ -5026,12 +5032,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl

// Assign registers to variables, etc.

///////////////////////////////////////////////////////////////////////////////
// Dominator and reachability sets are no longer valid. They haven't been
// maintained up to here, and shouldn't be used (unless recomputed).
///////////////////////////////////////////////////////////////////////////////
fgDomsComputed = false;

// Create LinearScan before Lowering, so that Lowering can call LinearScan methods
// for determining whether locals are register candidates and (for xarch) whether
// a node is a containable memory op.
Expand Down

0 comments on commit a9f9745

Please sign in to comment.