Skip to content

JIT: consider using new temp to capture improved type from an optimized cast #9117

Closed
dotnet/coreclr
#27397
@AndyAyersMS

Description

@AndyAyersMS

dotnet/coreclr#14420 will optimize sucessful ISINST(x) orCASTCLASS(x) to be simply x. However the successful cast may give us "better" type information about x than we had before, and right now we lose that information.

We attempt this type improvement for some of the unoptimized cases when the result is produced in a temp, see the last few lines of impCastClassOrIsInstToTree. However blindly setting the type to the cast type may not always be better. For instance casting from a known class to an interface type isn't really providing much in the way of useful information.

So we should only do this sort of thing when the target type is a class, and we've cast from supertype to subtype, or from an interface to a class type.

category:cq
theme:importer
skill-level:expert
cost:small

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions