Skip to content

Commit 090e349

Browse files
authored
JIT: Update IL offsets in fgExpandStaticInitForCall (#99662)
* Do not set the code offsets for BBF_INTERNAL blocks * Setting block->bbCodeOffsEnd to BAD_IL_OFFSET when expanding static init for calls * Only update IL offsets in fgSplitBlockAfterStatement if the original block had a valid ending offset * Update IL offsets when expanding static init calls
1 parent a903714 commit 090e349

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/coreclr/jit/helperexpansion.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,17 @@ bool Compiler::fgExpandStaticInitForCall(BasicBlock** pBlock, Statement* stmt, G
15031503

15041504
// Clear gtInitClsHnd as a mark that we've already visited this call
15051505
call->gtInitClsHnd = NO_CLASS_HANDLE;
1506+
1507+
// Update the IL offsets of the blocks to match the split.
1508+
1509+
// prevBb->bbCodeOffs remains the same
1510+
block->bbCodeOffsEnd = prevBb->bbCodeOffsEnd;
1511+
1512+
IL_OFFSET splitPointILOffset = fgFindBlockILOffset(block);
1513+
1514+
prevBb->bbCodeOffsEnd = max(prevBb->bbCodeOffs, splitPointILOffset);
1515+
block->bbCodeOffs = min(splitPointILOffset, block->bbCodeOffsEnd);
1516+
15061517
return true;
15071518
}
15081519

0 commit comments

Comments
 (0)