Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acc3f0c

Browse files
authored
Update the place where we assert about align presence while removing jump to next instr (#95845)
* Move the assert about align in proper place * remove extra check for removable jump * fix merge conflict
1 parent 6771302 commit acc3f0c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/coreclr/jit/codegenlinear.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,8 @@ void CodeGen::genCodeForBBlist()
744744
break;
745745
}
746746
#ifdef TARGET_XARCH
747-
// If a block was selected to place an alignment instruction because it ended
748-
// with a jump, do not remove jumps from such blocks.
749747
// Do not remove a jump between hot and cold regions.
750-
bool isRemovableJmpCandidate =
751-
!block->hasAlign() && !compiler->fgInDifferentRegions(block, block->GetTarget());
748+
bool isRemovableJmpCandidate = !compiler->fgInDifferentRegions(block, block->GetTarget());
752749

753750
inst_JMP(EJ_jmp, block->GetTarget(), isRemovableJmpCandidate);
754751
#else

src/coreclr/jit/emit.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,7 +4632,6 @@ void emitter::emitRemoveJumpToNextInst()
46324632
#if DEBUG
46334633
assert(jmp->idInsFmt() == IF_LABEL);
46344634
assert(emitIsUncondJump(jmp));
4635-
assert((jmpGroup->igFlags & IGF_HAS_ALIGN) == 0);
46364635
assert((jmpGroup->igNum > previousJumpIgNum) || (previousJumpIgNum == (UNATIVE_OFFSET)-1) ||
46374636
((jmpGroup->igNum == previousJumpIgNum) && (jmp->idDebugOnlyInfo()->idNum > previousJumpInsNum)));
46384637
previousJumpIgNum = jmpGroup->igNum;
@@ -4646,6 +4645,8 @@ void emitter::emitRemoveJumpToNextInst()
46464645

46474646
if ((jmpGroup->igNext == targetGroup) && ((jmpGroup->igFlags & IGF_HAS_REMOVABLE_JMP) != 0))
46484647
{
4648+
assert(!jmpGroup->endsWithAlignInstr());
4649+
46494650
// the last instruction in the group is the jmp we're looking for
46504651
// and it jumps to the next instruction group so we don't need it
46514652
CLANG_FORMAT_COMMENT_ANCHOR
@@ -4736,11 +4737,6 @@ void emitter::emitRemoveJumpToNextInst()
47364737
JITDUMP("IG%02u IN%04x jump target is not set!, keeping.\n", jmpGroup->igNum,
47374738
jmp->idDebugOnlyInfo()->idNum);
47384739
}
4739-
else if ((jmpGroup->igFlags & IGF_HAS_ALIGN) != 0)
4740-
{
4741-
JITDUMP("IG%02u IN%04x containing instruction group has alignment, keeping.\n", jmpGroup->igNum,
4742-
jmp->idDebugOnlyInfo()->idNum);
4743-
}
47444740
else if (jmpGroup->igNext != targetGroup)
47454741
{
47464742
JITDUMP("IG%02u IN%04x does not jump to the next instruction group, keeping.\n", jmpGroup->igNum,
@@ -4752,6 +4748,11 @@ void emitter::emitRemoveJumpToNextInst()
47524748
"keeping.\n",
47534749
jmpGroup->igNum, jmp->idDebugOnlyInfo()->idNum);
47544750
}
4751+
else if (jmpGroup->endsWithAlignInstr())
4752+
{
4753+
JITDUMP("IG%02u IN%04x containing instruction group has alignment, keeping.\n", jmpGroup->igNum,
4754+
jmp->idDebugOnlyInfo()->idNum);
4755+
}
47554756
#endif // DEBUG
47564757
}
47574758
}

0 commit comments

Comments
 (0)