Skip to content

Extend JIT Cast Removal Pattern for Simple Ops #121384

@adamperlin

Description

@adamperlin

#120980 brings new range assertions that allow casts on bitwise operations such as and to be eliminated in some cases since the range of the op can now be proven to be within bounds of the cast target. However, we have existing logic in fgSimpleLowerCastOfSmpOp which expects to match an outer cast and perform the optimization: CAST(AND(CAST(x), CAST(y))) -> CAST(AND(x, y)). This means that in some cases this match is now broken by the cast elimination in an earlier phase, and we still end up with two casts for both the operands, i.e. AND(CAST(x), CAST(y)). We should see if we can improve the logic here such that we can still optimize these cases down to only at most one cast.

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions