Skip to content

JIT: Unify post-order cmp transforms intofgOptimizeCmp#127883

Open
BoyBaykiller wants to merge 5 commits intodotnet:mainfrom
BoyBaykiller:unify-cmp-transforms
Open

JIT: Unify post-order cmp transforms intofgOptimizeCmp#127883
BoyBaykiller wants to merge 5 commits intodotnet:mainfrom
BoyBaykiller:unify-cmp-transforms

Conversation

@BoyBaykiller
Copy link
Copy Markdown
Contributor

Zero diffs.

@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 6, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 6, 2026
Comment thread src/coreclr/jit/morph.cpp Outdated
return cmp;
}

// TODO-CQ: This should be called for all comparisons
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This preserves previous behaviour to keep 0 diffs. But in a follow up PR I will enable this for EQ/NE too

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Comment thread src/coreclr/jit/morph.cpp Outdated

//------------------------------------------------------------------------
// fgOptimizeRelationalComparisonWithFullRangeConst: optimizes a comparison operation.
// fgOptimizeCmpLtLeGeGtFullRangeConst: optimizes a comparison operation.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this name is odd, the previous was better IMO. in other places we use the word "relops"

Copy link
Copy Markdown
Member

@EgorBo EgorBo May 8, 2026

Choose a reason for hiding this comment

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

I think it should accept all relops including EQ and NE, and then just call the other func for EQ/NE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it should accept all relops including EQ and NE, and then just call the other func for EQ/NE

As far as I understand the two corresponding functions are
fgOptimizeCmpEqNeWithConst (for Eq/Ne)
fgOptimizeCmpLtLeGeGtWithConst (for the others)

but fgOptimizeCmpLtLeGeGtFullRangeConst is it's own thing which can return a cns tree while the other twp only modify the oper. So I don't think I should start calling fgOptimizeCmpEqNeWithConst in here.
However I will follow tanners advice and remove the LtLeGeGt part here.

this name is odd, the previous was better IMO. in other places we use the word "relops"

RelationalComparison is kinda long. I liked "cmp" because the optimizations apply to all tree->OperIsCmpCompare() trees so the names match. However I know we also use "relop" a bunch so I'd be fine with that too.

@BoyBaykiller
Copy link
Copy Markdown
Contributor Author

@EgorBo does this need any other changes? If I understood correctly "cmp" over "relop" is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

2 participants