{
// Jit can only inline expand CHKCASTCLASS and CHKCASTARRAY helpers.
canExpandInline = (helper == CORINFO_HELP_CHKCASTCLASS) || (helper == CORINFO_HELP_CHKCASTARRAY);
+
+ // For ChkCastAny we ignore cases where the class is known to be abstract or is an interface.
+ if (helper == CORINFO_HELP_CHKCASTANY)
+ {
+ const bool isAbstract = (info.compCompHnd->getClassAttribs(pResolvedToken->hClass) &
+ (CORINFO_FLG_INTERFACE | CORINFO_FLG_ABSTRACT)) != 0;
+ canExpandInline = !isAbstract;
+ }
}
else if ((helper == CORINFO_HELP_ISINSTANCEOFCLASS) || (helper == CORINFO_HELP_ISINSTANCEOFARRAY))
{
if (isCastClass)
{
assert((helper == CORINFO_HELP_CHKCASTCLASS) || (helper == CORINFO_HELP_CHKCASTARRAY) ||
- (helper == CORINFO_HELP_CHKCASTINTERFACE));
+ (helper == CORINFO_HELP_CHKCASTANY) || (helper == CORINFO_HELP_CHKCASTINTERFACE));
CorInfoHelpFunc specialHelper = helper;
if ((helper == CORINFO_HELP_CHKCASTCLASS) &&