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

JIT: Allow jump-to-next-block removal for blocks with alignment #97011

Merged
merged 3 commits into from
Feb 2, 2024
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/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ bool BasicBlock::IsFirstColdBlock(Compiler* compiler) const
bool BasicBlock::CanRemoveJumpToNext(Compiler* compiler) const
{
assert(KindIs(BBJ_ALWAYS));
return JumpsToNext() && !hasAlign() && !compiler->fgInDifferentRegions(this, bbTarget);
return JumpsToNext() && (bbNext != compiler->fgFirstColdBlock);
}

//------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ void CodeGen::genCodeForBBlist()

/* Do we need to generate a jump or return? */

bool removedJmp = false;
switch (block->GetKind())
{
case BBJ_RETURN:
Expand Down Expand Up @@ -733,6 +734,7 @@ void CodeGen::genCodeForBBlist()
}
#endif // TARGET_AMD64

removedJmp = true;
break;
}
#ifdef TARGET_XARCH
Expand Down Expand Up @@ -811,7 +813,7 @@ void CodeGen::genCodeForBBlist()
assert(!block->KindIs(BBJ_CALLFINALLY));
#endif // FEATURE_EH_CALLFINALLY_THUNKS

GetEmitter()->emitLoopAlignment(DEBUG_ARG1(block->KindIs(BBJ_ALWAYS)));
GetEmitter()->emitLoopAlignment(DEBUG_ARG1(block->KindIs(BBJ_ALWAYS) && !removedJmp));
}

if (!block->IsLast() && block->Next()->isLoopAlign())
Expand Down