Skip to content

JIT: examine need for canInlineTypeCheckWithObjectVTable #10341

@AndyAyersMS

Description

@AndyAyersMS

When the jit is optimizing type equality and inequality tests, it may run into the following case:

    object.GetType() == typeof(X)

This can usually be optimized into a comparison of the object's method table pointer versus a known method table address. But historically that has not always been a valid optimization. So the jit calls canInlineTypeCheckWithObjectVTable to identify the cases where the optimization is valid.

https://github.com/dotnet/coreclr/blob/3c01252879f2d2223f63d5b222b6584c28fc07f4/src/jit/gentree.cpp#L13141-L13147

Per Jan's comments in #10332, it seems in CoreCLR this optimization is likely always valid and the check is no longer needed.

category:cq
theme:basic-cq
skill-level:intermediate
cost:small

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions