You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT Optimization: Merge multiple inc into one add #65025
Note forward sub (#63720) does not handle cases where a local has multiple definitions and uses, even if each definition has just one use. It might not be too hard to extend it to cover these cases.
Eg if we run it again once SSA is built and track the number of uses of each SSA def.
Activity
danmoseley commentedon Feb 9, 2022
This does not seem to be what C++ compilers do: https://godbolt.org/z/r1f7Pxdfa
Curious to know why.
omariom commentedon Feb 9, 2022
@danmoseley
With optimization flags https://godbolt.org/z/MPcor1xEP
danmoseley commentedon Feb 9, 2022
@omariom thanks, I thought that was default.
deeprobin commentedon Feb 9, 2022
Same for
dechttps://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIGYACMhgYQYG8aHunGBLAHYYGAQQAUg4dgCUHLjwXY4cANzyF3JavUbiAdgbY11BQF8dO+g0kMAQhKGHZnExs0M4AXgaljb7vqGfjzm1KZAA==
Expected result
And
inc+decelimination would be nicehttps://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIGYACMhgYQYG8aHunGBLAHYYGAQQAUg4dgCUHLjwXYA1EoDc8hd2xw466pp7K1GzcQDsDbHoUBfEyfoNJDAEIShl2Z30HLK677mlgHcdtQ2QA=
Expected result
dubiousconst282 commentedon Feb 9, 2022
IMO this should be generalized to all operators.
Interestingly, copying to temporary variables will result in optimal code, so maybe this is related to SSA/constant propagation:
Sharplab
JulieLeeMSFT commentedon Feb 9, 2022
cc @dotnet/jit-contrib
AndyAyersMS commentedon Feb 9, 2022
Note forward sub (#63720) does not handle cases where a local has multiple definitions and uses, even if each definition has just one use. It might not be too hard to extend it to cover these cases.
Eg if we run it again once SSA is built and track the number of uses of each SSA def.