Skip to content

Conversation

@SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Sep 28, 2021

With #55186 merged, I was looking to take advantage of IntegralRange in fgMorphCast, but it turned out some refactoring was first in order, mainly to get rid of questionable & duplicated code. So that's what this PR is about. See the commit messages for the description of the changes.

Also some comments have been added.

Diffs for this change: win-x64, win-x86, linux-arm.

@ghost ghost added community-contribution Indicates that the PR has been added by a community member 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 Sep 28, 2021
@ghost
Copy link

ghost commented Sep 28, 2021

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

Issue Details

With #55186 merged, I was looking to take advantage of IntegralRange in fgMorphCast, but it turned out some refactoring was first in order, mainly to get rid of questionable & duplicated code. So that's what this PR is about. See the commit messages for the description of the changes.

Also some comments have been added.

Diffs for this change: pending.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@SingleAccretion SingleAccretion force-pushed the Refactor-fgMorphCast branch 4 times, most recently from d8180bc to eb37a03 Compare September 28, 2021 22:05
Split it into the part that does pre-order transforms
and the part that does post-order optimizations.

Rename the pre-order part to "fgMorphExpandCast" and let
"fgMorphSmpOp" do the morphing of operands and optimization.

Just one diff for this commit: "gtFoldExprConst" does not
retain the types of handles, thus LSRA was not seeing
"long" and "byref" constant integers with the same values as
equivalent and did not reuse the register.
These cases are now covered by "fgMorphSmpOp".
So that it works well for casts.

There are diffs for this commit in the ILGEN methods,
mostly positive, but some are regressions.

The regressions fall into 2 buckets:
  1. The new code creates overflow helper blocks for casts
     before propagating comma throws, thus leaving them
     around, dead. This is a problem in general and should
     be solved by moving the helper insertion later.
  2. The new code doesn't propagate comma throws after global
     morph for casts. This is is by design, as the throw
     propagation does not work well with VNs (and CSE).

The improvements are due to new code setting "fgRemoveRestOfBlock"
for comma throws originating from casts.
@SingleAccretion SingleAccretion marked this pull request as ready for review September 29, 2021 20:02
@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

@BruceForstall
Copy link
Contributor

/azp run runtime-coreclr jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SingleAccretion
Copy link
Contributor Author

Stress failures appear to be #59794.

Copy link
Contributor

@BruceForstall BruceForstall 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 for the contribution!

@BruceForstall BruceForstall merged commit d500e00 into dotnet:main Sep 30, 2021
@SingleAccretion SingleAccretion deleted the Refactor-fgMorphCast branch September 30, 2021 22:41
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
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.

2 participants