Skip to content

JIT known generic casts not elided #38106

Closed
@HurricanKai

Description

@HurricanKai

Description

When writing generic types, using a pattern as seen in Vector<T> (if (typeof(T) == typeof(int)) ... if (typeof(T) == typeof(float)) ...) once this construct grows to 9 blocks JIT will end up not correctly eliding some casts:
See sharplab
Removing any two blocks from As2<T> will improve code gen significantly (matching a non-generic version & the other version)
splitting up the function will also resolve the issue.

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

Relationships

None yet

Development

No branches or pull requests

Issue actions