Evaluate RyuJIT logic for generating return blocks #8406
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
enhancement
Product code improvement that does NOT require public API changes/additions
optimization
Priority:3
Work that is nice to have
tenet-performance
Performance related issue
Milestone
RyuJIT may generate multiple return blocks unnecessarily. The current logic allows a method to have up to 4 separate return blocks unless a profiler hook is needed, or the method is marked synchronized, or the method calls unmanaged code, or REVERSE_PINVOKE_{ENTER,EXIT} helper calls need to be inserted in prolog/epilog.
The legacy 64-bit jit tried to generate a single return path whenever possible. Here is an example where it would make sense:
Here is the code generated for getChars.MyXMLNodeWriter:UnsafeGetUTF8Chars:
The two return sequences are identical so there is no need for this code bloat.
category:cq
theme:block-layout
skill-level:intermediate
cost:medium
impact:small
The text was updated successfully, but these errors were encountered: