Skip to content

Conversation

@MichalPetryka
Copy link
Contributor

As requested in #97959 (comment)

cc @jkotas

@ghost ghost added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners community-contribution Indicates that the PR has been added by a community member labels Feb 8, 2024
@MichalPetryka
Copy link
Contributor Author

@MihuBot

@xtqqczze
Copy link
Contributor

xtqqczze commented Feb 9, 2024

Some comments "// Test d2 first to allow branch elimination" should be removed/updated.

@jkotas
Copy link
Member

jkotas commented Feb 10, 2024

@MihuBot

Comment on lines 178 to 179
// Test d2 first to allow branch elimination when inlined for not null checks (!= null)
// so it can become a simple test
Copy link
Member

Choose a reason for hiding this comment

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

These comments aren't really "correct" anymore

We should likely ensure that the same general codegen and dead code elimination still happens when inlined (for RyuJIT and Mono).

Copy link
Member

@jkotas jkotas Feb 11, 2024

Choose a reason for hiding this comment

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

We should likely ensure that the same general codegen and dead code elimination still happens

+1. The MihuBot report has number of regressions. The regressions seem to be caused by dead code elimination no longer happening - a lot of new System.Object:Equals calls that did not exist before.

Copy link
Member

Choose a reason for hiding this comment

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

The list of regressions seems to be a good data point about methods that use == null / != null, but that should better be using is null / is not null instead.

Copy link
Member

@jkotas jkotas Feb 11, 2024

Choose a reason for hiding this comment

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

The list of regressions seems to be a good data point about methods that use == null / != null, but that should better be using is null / is not null instead.

Are you interested in a submitting PR that fixes these? (Just in the shipping libraries, tests can and should stay as is.)

Copy link
Contributor Author

@MichalPetryka MichalPetryka Feb 13, 2024

Choose a reason for hiding this comment

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

use == null / != null, but that should better be using is null / is not null instead.

Are custom .Equals implementations that might return true with a single null (like for example with Unity) not a concern here?

Copy link
Member

Choose a reason for hiding this comment

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

We can look at it case-by-case. Most of the affected operator implementations check for the null upfront and won't call Equals with null.

Do you have an example of where it may be a problem?

@danmoseley danmoseley added area-System.Runtime and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 20, 2024
@ghost
Copy link

ghost commented Feb 20, 2024

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

As requested in #97959 (comment)

cc @jkotas

Author: MichalPetryka
Assignees: -
Labels:

area-System.Runtime, community-contribution

Milestone: -

@jkotas jkotas marked this pull request as draft April 1, 2024 14:19
@dotnet-policy-service
Copy link
Contributor

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Runtime 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.

5 participants