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
Chained comparison of two integers against a constant is not coalesced #102103
base: main
Are you sure you want to change the base?
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Seems to have regressions on arm64 too 😢 I suppose Clang/LLVM reasons about these in a more generalized way... 612735.dasm - Program:InstanceMethodTest():ubyte (FullOpts)
@@ -174,11 +174,14 @@ G_M34320_IG08: ; bbWeight=1, gcrefRegs=0000 {}, byrefRegs=0000 {}, byref
ldr x3, [x3]
blr x3
; gcrRegs -[x1-x2 x22]
- cmn w20, #1
+ movn w0, #41
+ eor w0, w21, w0
+ movn w1, #0
+ eor w1, w20, w1
+ orr w0, w0, w1
+ cmp w0, #0
cset x0, eq
- cmn w21, #42
- csel w0, wzr, w0, ne
- ;; size=88 bbWeight=1 PerfScore 16.00
+ ;; size=100 bbWeight=1 PerfScore 17.50 |
It seems the regressions happen on ARM because it already supports conditional select in assembly which prevents from creating branches. Our optimization seems to confuse the JIT from recognizing the pattern and using the csel in certain methods. |
Fixes #101347