Commit c8d6048
authored
JIT: Improve block IL offset range selection when splitting (#121298)
In debug codegen we expect basic blocks to have valid start IL offsets,
potentially to an invalid IL end offset.
When we split a block at a node, we find the end offset by looking
backwards from that node for an `IL_OFFSET` node. If we find such a
node, we use it as the split point IL offset. Otherwise we use
`BAD_IL_OFFSET` and start the next block at the end offset (making it
have a 0 byte range).
This latter behavior is problematic if the bottom portion of the split
has its own `IL_OFFSET` nodes. In that case we can end up with
`IL_OFFSET` nodes pointing outside the region of the basic block. If we
later split again, then we can end up creating illegal IL offset ranges
for unoptimized code. In an example case we first ended up with the
bottom block having an IL offset range of `[0aa..0aa)` but still
containing an `IL_OFFSET` with an offset of `092`. When we later split
the bottom block again we ended up with `[0aa..0aa), [092..0aa)` and hit
an assert.
To address the problem change the behavior in the following way:
* If we find no `IL_OFFSET` node in the upper block, then look for one
in the lower block, and use its value as the split point
* If we find no `IL_OFFSET` in both blocks then consider the lower block
empty and the upper block to have everything (same behavior as before).
* One exception to above: if the end was already `BAD_IL_OFFSET` then we
have to consider the upper block to be empty as we cannot represent the
other case
This fixes #119616. However for that specific case, which is inside
async code, we will have the exact IL offset of the async call we are
splitting at after #120303, so we will be able to do better. I'll make
that change as part of that PR.1 parent 7bcfee1 commit c8d6048
1 file changed
+27
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4840 | 4840 | | |
4841 | 4841 | | |
4842 | 4842 | | |
4843 | | - | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
| 4851 | + | |
| 4852 | + | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
| 4859 | + | |
4844 | 4860 | | |
4845 | | - | |
4846 | | - | |
4847 | | - | |
| 4861 | + | |
| 4862 | + | |
| 4863 | + | |
| 4864 | + | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
| 4868 | + | |
| 4869 | + | |
| 4870 | + | |
4848 | 4871 | | |
4849 | 4872 | | |
4850 | 4873 | | |
| |||
0 commit comments