JIT: missing conditional branch merging across multiple BBs #59863
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
tenet-performance
Performance related issue
Milestone
Description
RyuJit currently misses some optimization opportunities when there are multiple BBs with conditional branches that could be merged, and instead result in avoidable conditional branches in the final codegen. Consider this example:
This results in the following codegen:
Here the two BBs with the LT and EQ tests could just be combined in a single LE one, which could result in eg. a single
seta
in the final codegen here, or in a singlejle
if the method was inlined and the caller was to do a conditional branch on its return.Courtesy of @EgorBo for these trees, we basically need the following optimization:
And the same for all possible conditional combinations as well (eg. GT+EQ to GE, etc.).
Configuration
Tested on .NET 5 stable, and also on .NET 6 (daily builds, with Disasmo).
Regression?
Nope.
category:correctness
theme:ir
skill-level:intermediate
cost:small
impact:small
The text was updated successfully, but these errors were encountered: