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

Stop marking volatile indirections as NO_CSE #62043

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Nov 25, 2021

It is unnecessary - we model volatile indirections as mutating the global heap in value numbering and thus they can only ever be CSE defs, which is legal in our model (only volatile operations serve as mutators as per ECMA).

We get some good small diffs this way.

However, the real purpose of this change is making fixing the incorrect assertions for L-value indirections (#13762, reproduction), which will be identified by the presence of the GTF_NO_CSE flag, as that is the only reliable way to detect L-values in the compiler, mostly zero-diff.

We could venture and add something like a GTF_LVALUE flag (I think we had one with that very name at some point...), but that seems very risky - how many a place today forgets about GTF_NO_CSE, certainly plumbing the new flag through will not be a pleasant, or good, long-term solution. The proper solution is to delete GT_ASG, but that, of course, is not something done in one weekend :), and it seems bad to leave known silent bad codegen bugs hanging around in the meantime.

Full diffs.

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

ghost commented Nov 25, 2021

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

Issue Details

It is unnecessary - we model volatile indirections as mutating the global heap in value numbering and thus they can only ever be CSE defs, which is legal in our model (only volatile operations serve as mutators as per ECMA).

We get some good small diffs this way.

However, the real purpose of this change is making fixing the incorrect assertions for L-value indirections (#13762, reproduction), which will be identified by the presence of the GTF_NO_CSE flag, as that is the only reliable way to detect L-values in the compiler, mostly zero-diff.

We could venture and add something like a GTF_LVALUE flag (I think we had one with that very name at some point...), but that seems very risky - how many a place today forgets about GTF_NO_CSE, certainly plumbing the new flag through will not be a pleasant, or good, long-term solution. The proper solution is to delete GT_ASG, but that, of course, is not something done in one weekend :), and it seems bad to leave known silent bad codegen bugs hanging around in the meantime.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@SingleAccretion SingleAccretion force-pushed the Incorrect-Null-Assertions branch from efafc41 to d1a7d8a Compare December 1, 2021 12:15
@SingleAccretion SingleAccretion marked this pull request as ready for review December 3, 2021 12:56
@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

@jakobbotsch
Copy link
Member

@dotnet/jit-contrib I am OOF next week so if somebody else wants to give this a lookover before I'm back then please do.

It is unnecessary - we model volatile indirections as mutating
the global heap in value numbering and thus they can only ever
be CSE defs, which is legal in our model (only volatile operations
serve as mutators as per ECMA).

We get some good small diffs this way.

However, the real purpose of this change is making fixing the
incorrect assertions for L-value indirections, which will be
identified by the presence of the GTF_NO_CSE flag, as that is
the only reliable way to detect L-values in the compiler, mostly
zero-diff.

We could venture and add something like a GTF_LVALUE flag (I
think we had one with that very name at some point...), but that
seems very risky - how many a place today forgets about GTF_NO_CSE,
certainly plumbing the new flag through will not be a pleasant, or
good, long-term solution. The proper solution is to delete GT_ASG,
but that,  of course, is not something done in one weekend :), and
it seems bad to leave known silent bad codegen bugs hanging around
in the meantime.
@SingleAccretion SingleAccretion force-pushed the Incorrect-Null-Assertions branch from d1a7d8a to 10877fd Compare December 10, 2021 17:57
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.

LGTM, thanks! I reran the failing CI leg, so will wait for that.

@jakobbotsch jakobbotsch merged commit f5ee50e into dotnet:main Dec 13, 2021
@SingleAccretion SingleAccretion deleted the Incorrect-Null-Assertions branch December 13, 2021 19:14
@ghost ghost locked as resolved and limited conversation to collaborators Jan 13, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants