Skip to content

Commit

Permalink
Allow jump removal for aligned BBJ_ALWAYS
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid committed Jan 15, 2024
1 parent a77c0b4 commit f47aaf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit f47aaf8

Please sign in to comment.