On x86_64, JIT could reorder numeric operations to use the flag for subsequent conditional branch but does not do so #109042
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
tenet-performance
Performance related issue
untriaged
New issue has not been triaged by the area owner
Description
Given simple program
Iterate
compiles towhich is quite a bit worse than doing similar with a plain array foreach:
Analysis
The
test
could be elided if JIT gains the ability to perform a peephole which reorders numeric operations where there are potential consumers for the flags that they set.Another minor note is a missed opportunity to merge
mov
andadd
.I have also noticed that merging pointer dereference and post-increment into
*ptr++
leads to worse codegen overall (breaking otherwise perfect output for ARM64), even though it shouldn't.Configuration
Regression?
No
The text was updated successfully, but these errors were encountered: