JIT: eliminate tests for completely determined expressions #10828
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
Milestone
I'd like the JIT to detect when one branch leads to another branch, and fold them into a single branch.
I'm sure this optimization has a specific name in compiler theory, but I don't know it. If you'll excuse a dumb example:
Here, a sufficiently advanced compiler should be able to transform this into something like:
Why?
Obviously, the dumb example is not what I'm actually doing. For performance purposes I'm updating a text parser from depending on
char
to be encoding-agnostic. In some places, it needs to allow injecting inlineable sub-parsers that handles encoding-specific things:This sits right in a hotspot in my code: optimizing this bit makes a huge difference. I've found the extra tests needed to check the return value are causing the code to perform at about 1/4th the speed when compared to a non-agnostic version with
IsNewLine
manually inlined. Having the compiler optimize away these tests would make a huge difference to me.category:cq
theme:optimization
skill-level:expert
cost:large
The text was updated successfully, but these errors were encountered: