Skip to content

Commit

Permalink
Fix optIsLoopEntry to skip removed loops (#61527)
Browse files Browse the repository at this point in the history
This was preventing block compaction with loop entry blocks in loops
that had been previously optimized away (and thus removed from the
loop table).

There are a few cases where we now delete dead code that was previously
left in the function. There are a number of spurious local weighting
and IG textual asm diffs changes, possibly due to how PerfScore is implemented
(there are some surprisingly large PerfScore changes in a few cases,
despite no change in (most) generated code).
  • Loading branch information
BruceForstall committed Nov 12, 2021
1 parent c580f49 commit 16b970a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,7 +2649,11 @@ bool Compiler::optIsLoopEntry(BasicBlock* block) const
{
for (unsigned char loopInd = 0; loopInd < optLoopCount; loopInd++)
{
// Traverse the outermost loops as entries into the loop nest; so skip non-outermost.
if ((optLoopTable[loopInd].lpFlags & LPFLG_REMOVED) != 0)
{
continue;
}

if (optLoopTable[loopInd].lpEntry == block)
{
return true;
Expand Down

0 comments on commit 16b970a

Please sign in to comment.