Optimize Enum.GetUnderlyingType
with a known type to a constant
#70483
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
in-pr
There is an active PR which will close this issue when it is merged
tenet-performance
Performance related issue
Milestone
Description
Enum.GetUnderlyingType
currently always does a runtime lookup even when the type is always known, for example due to being a generic parameter. This makes fast generic specialization on enums impossible, unless you specialize on their size, which in turn makes you loose information about the sign.Having this optimized would make #70167 much more useful since currently you have no fast way to check if the conversion is safe.
Configuration
Core CLR 6.0.322.12309 on amd64 on SharpLab
Regression?
I don't think so, but haven't checked other runtimes.
Data
SharpLab
category:cq
theme:basic-cq
skill-level:intermediate
cost:medium
impact:small
The text was updated successfully, but these errors were encountered: