Skip to content

Generic cast could be elided #118693

@xtqqczze

Description

@xtqqczze

Generic casts such as the following pattern result in a redundant cast helper call:

if (enumerable.GetType() == typeof(Dictionary<TKey, TValue>))
{
Dictionary<TKey, TValue> source = (Dictionary<TKey, TValue>)enumerable;

This necessitates using Unsafe.As for optimal codegen.

Diffs: MihuBot/runtime-utils#1382

Related: #118684

Metadata

Metadata

Assignees

No one assigned

    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