Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify JIT label handling #51208

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4667,7 +4667,7 @@ void emitter::emitLoopAlignment()
//-----------------------------------------------------------------------------
// emitEndsWithAlignInstr: Checks if current IG ends with loop align instruction.
//
// Returns: true if current IG ends with align instruciton.
// Returns: true if current IG ends with align instruction.
//
bool emitter::emitEndsWithAlignInstr()
{
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ void Compiler::optUnmarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk)
break;
}
}

JITDUMP("\n");

#if FEATURE_LOOP_ALIGN
if (begBlk->isLoopAlign())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch, I think I missed this earlier although there was one rare case that I handled in :

runtime/src/coreclr/jit/morph.cpp

Lines 16607 to 16610 in f958f2b

#if FEATURE_LOOP_ALIGN
optLoopTable[loopNum].lpFirst->bbFlags &= ~BBF_LOOP_ALIGN;
JITDUMP("Removing LOOP_ALIGN flag from bogus loop in " FMT_BB "\n",
optLoopTable[loopNum].lpFirst->bbNum);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just sent out draft PR #51313 to test how often we retain align flag on blocks that are no longer loop. Probably not because we might have hit an assert during codegen, but just want to double check.

{
// Clear the loop alignment bit on the head of a loop, since it's no longer a loop.
begBlk->bbFlags &= ~BBF_LOOP_ALIGN;
JITDUMP("Removing LOOP_ALIGN flag from removed loop in " FMT_BB "\n", begBlk->bbNum);
}
#endif
}

/*****************************************************************************************************
Expand Down