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

Commutative morph optimizations #64122

Merged
merged 4 commits into from
Jan 28, 2022

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Jan 21, 2022

As promised in #63251, there was some low-hanging fruit in the code. This change picks it:

  1. Make better use of optimization order.
  2. Fold x + 0 for CNS_LNG too.
  3. Drop one unnecessary fgGlobalMorph guard.
  4. Finally, disable the "mulshift" optimization on non-XARCH targets.

Diffs. Win-x64 diffs didn't make it for unclear reasons, here's the locally obtained version: win-x64 diffs.

@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 Jan 21, 2022
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jan 21, 2022
@ghost
Copy link

ghost commented Jan 21, 2022

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

Issue Details

As promised in #63251, there was some low-handing fruit in the code. This change picks it up:

  1. Make better use of optimization order.
  2. Fold x + 0 for CNS_LNG too.
  3. Drop one unnecessary fgGlobalMorph guard.
  4. Finally, disable the "mulshift" optimization on non-XARCH targets.

We are expecting some pretty nice diffs form all the above combined.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@SingleAccretion SingleAccretion changed the title Commutative morph opt Commutative morph optimizations Jan 21, 2022
@SingleAccretion SingleAccretion marked this pull request as ready for review January 22, 2022 12:48
@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

"fgMorphCommutative" exposes information to the later
transforms that make them more precise.

For example, "MUL(MUL(X, CONST1), CONST2)" is now morphed
properly into a single "mul" instead of one "mul" plus a shift
and lea in case "CONST2" was a viable candidate for "mulshift".

Another example is how "fgMorphCommutative" can end up with an
"ADD(X, 0)" that was only being discarded in lowering.
No reason not to. Just a few diffs.
No LEAs - no point.
@BruceForstall BruceForstall merged commit d06d9c9 into dotnet:main Jan 28, 2022
@SingleAccretion SingleAccretion deleted the Commutative-Morph-Opt branch January 28, 2022 20:24
@ghost ghost locked as resolved and limited conversation to collaborators Feb 28, 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 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