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

Delete the zero-offset field sequence map #71455

Merged
merged 13 commits into from
Jul 8, 2022

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Jun 29, 2022

In #68712 I promised that we'd delete the zero-offset field sequences. This change (finally, one could say) delivers on that promise.

There are still two scenarios where the root field sequence will have a zero offset:

  1. Some statics accessed via helpers.
  2. R2R-affected class fields.

Due to the fact the former cases are rare, this change represents them as ADD(baseAddr, 0 <field seq>), which requires minimal extra handling (just one special case in morph).

The latter cases are not handled in this change to minimize diffs. It is likely that, if/when I get to supporting them, an explicit annotation node will be used (similar to ARR_ADDR), however, for now, there is no need for it.

We have some diffs due to the usual consequences of more precise VNs (they are no longer "polluted" by zero-offset sequences.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 29, 2022
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jun 29, 2022
@ghost
Copy link

ghost commented Jun 29, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

In #68712 I promised that we'd delete the zero-offset field sequences. This change delivers on that promise.

There are still two scenarios we have where the root field sequence will have a zero offset:

  1. Some statics accessed via helpers.
  2. R2R-affected class fields.

Due to the fact the former cases are rare, this change represents them as ADD(baseAddr, 0 <field seq>).

The latter cases are not handled in this change to minimize diffs. It is likely that, if/when I get to supporting them, an explicit annotation node will be used (similar to ARR_ADDR), however, for now, there is no need for it.

We have some diffs due to the usual consequences of more precise VNs (they are no longer "polluted" by zero-offset sequences.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr, community-contribution

Milestone: -

@SingleAccretion SingleAccretion marked this pull request as ready for review June 30, 2022 15:16
@SingleAccretion
Copy link
Contributor Author

Libraries Test Run checked coreclr OSX x64 Debug failure is #70450.

@dotnet/jit-contrib

For statics at a zero offset, preserve the "CNS_INT 0" node instead.
This avoids regressing cases where we now have new CSE
opportunities for statics with static init helper calls.
Replace with using "nullptr" directly.

Note that "nullptr" can mean both an absense of a field
sequence and an "implicit" sequence of struct fields.
Now that we don't need the map to be a set, we can apply some optimizations.
We don't expect empty sequences: they are either coming from
the "IsFieldAddr" code path, which disallows these, or from
the boxed static code path, where we should always have them.
Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! I will trigger some stress jobs.

@jakobbotsch
Copy link
Member

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch
Copy link
Member

Most of the stress failures are #71748, but the arm32 libraries-jitstress failures look related to this or one of the recent changes:

Assert failure(PID 61 [0x0000003d], Thread: 74 [0x004a]): Assertion failed 'OperIs(GT_LCL_VAR, GT_LCL_VAR_ADDR, GT_STORE_LCL_VAR)' in 'System.Buffers.Binary.Tests.BinaryReaderUnitTests:SpanWriteAndReadBigEndianHeterogeneousStruct():this' during 'Lowering nodeinfo' (IL size 1323; hash 0x710360ec; FullOpts)

    File: /__w/1/s/src/coreclr/jit/gtstructs.h Line: 65
    Image: /root/helix/work/correlation/dotnet

@SingleAccretion
Copy link
Contributor Author

Assertion failed 'OperIs(GT_LCL_VAR, GT_LCL_VAR_ADDR, GT_STORE_LCL_VAR)'

Taking a look.

@SingleAccretion
Copy link
Contributor Author

Taking a look

In the dump we have STORE_LCL_FLD<float>(BITCAST<float>(ADD<int>)). On ARM, we presume all BITCASTs are multi-reg nodes, which ultimately leads us down the wrong path.

This is fallout from #71567, I have opened #71831 to track the fix.

@jakobbotsch
Copy link
Member

This is fallout from #71567, I have opened #71831 to track the fix.

Thanks for taking a look, looks like this change should be fine to merge then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants