Skip to content

Commutative morph optimizations - #64122

Merged
BruceForstall merged 4 commits into
dotnet:mainfrom
SingleAccretion:Commutative-Morph-Opt
Jan 28, 2022
Merged

Commutative morph optimizations#64122
BruceForstall merged 4 commits into
dotnet:mainfrom
SingleAccretion:Commutative-Morph-Opt

Conversation

@SingleAccretion

@SingleAccretionSingleAccretion commented Jan 21, 2022

Copy link
Copy Markdown
Contributor

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.

@ghostghost added 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 labels Jan 21, 2022
@ghost

Copy link
Copy Markdown

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:-

@SingleAccretionSingleAccretion changed the title Commutative morph optCommutative morph optimizationsJan 21, 2022
@SingleAccretion
SingleAccretion marked this pull request as ready for review January 22, 2022 12:48
@SingleAccretion

Copy link
Copy Markdown
ContributorAuthor

@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:mainJan 28, 2022
@SingleAccretion
SingleAccretion deleted the Commutative-Morph-Opt branch January 28, 2022 20:24
@ghostghost locked as resolved and limited conversation to collaborators Feb 28, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIcommunity-contributionIndicates 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

@SingleAccretion@BruceForstall@JulieLeeMSFT