Update fgMorphSmpOp to canonicalize commutative and compare ops at the start of POST-ORDER#127661
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR adjusts CoreCLR JIT morphing to canonicalize operand ordering for commutative operators and comparisons at the start of fgMorphSmpOp post-order processing, improving consistency and enabling post-order optimizations that rely on constants being placed predictably.
Changes:
- Canonicalize commutative and comparison trees in
fgMorphSmpOppost-order by swapping when the left operand is a constant (and swapping relops as needed). - Move the
((a % pow2) ==/!= 0) => (a & (pow2-1) ==/!= 0)pattern optimization from pre-order into theGT_EQ/GT_NEpost-order handling. - Strengthen/debug-guard morphing assumptions by asserting
fgMorphTreeis not invoked during the value-number CSE phase.
c1f0ad2 to
c4471af
Compare
…e start of POST-ORDER
c4471af to
b3541f8
Compare
|
@EgorBo, this should be ready now. There's a few regressions where folding looks to stop happening. It needs to be investigated, but I don't think we should block on it. There's likely some other places that aren't looking for or handling the right edges. |
any idea why osx-arm64 seems to be a pure regression? |
It has more opts being done, in part because it has a higher ISA baseline. |
No description provided.