Skip to content

Commit 16b970a

Browse files
Fix optIsLoopEntry to skip removed loops (#61527)
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).
1 parent c580f49 commit 16b970a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/coreclr/jit/optimizer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,11 @@ bool Compiler::optIsLoopEntry(BasicBlock* block) const
26492649
{
26502650
for (unsigned char loopInd = 0; loopInd < optLoopCount; loopInd++)
26512651
{
2652-
// Traverse the outermost loops as entries into the loop nest; so skip non-outermost.
2652+
if ((optLoopTable[loopInd].lpFlags & LPFLG_REMOVED) != 0)
2653+
{
2654+
continue;
2655+
}
2656+
26532657
if (optLoopTable[loopInd].lpEntry == block)
26542658
{
26552659
return true;

0 commit comments

Comments
 (0)