@@ -8963,9 +8963,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
89638963 CORINFO_CONTEXT_HANDLE exactContext = dvInfo.tokenLookupContext ;
89648964 CORINFO_RESOLVED_TOKEN * pDerivedResolvedToken = &dvInfo.resolvedTokenDevirtualizedMethod ;
89658965
8966- CORINFO_SIG_INFO derivedSig;
8967- info.compCompHnd ->getMethodSig (derivedMethod, &derivedSig);
8968-
89698966 unsigned derivedMethodAttribs = 0 ;
89708967 bool derivedMethodIsFinal = false ;
89718968 bool canDevirtualize = false ;
@@ -8974,21 +8971,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
89748971 const char * note = " inexact or not final" ;
89758972#endif
89768973
8977- // Array interface devirt can return a nonvirtual generic method of the non-generic SZArrayHelper class.
8978- //
8979- if (derivedSig.hasTypeArg ())
8980- {
8981- // If we don't know the array type exactly we may have the wrong interface type here.
8982- // Bail out.
8983- //
8984- const bool isArrayInterfaceDevirt = (objClassAttribs & CORINFO_FLG_ARRAY ) != 0 ;
8985- if (isArrayInterfaceDevirt && !isExact)
8986- {
8987- JITDUMP (" Array interface devirt: array type is inexact, sorry.\n " );
8988- return ;
8989- }
8990- }
8991-
89928974 // If we failed to get a method handle, we can't directly devirtualize.
89938975 //
89948976 // This can happen with AOT, if the devirtualization crosses
@@ -9027,6 +9009,24 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
90279009 canDevirtualize = isExact || objClassIsFinal || (!isInterface && derivedMethodIsFinal);
90289010 }
90299011
9012+ CORINFO_SIG_INFO derivedSig;
9013+ info.compCompHnd ->getMethodSig (derivedMethod, &derivedSig);
9014+
9015+ // Array interface devirt can return a nonvirtual generic method of the non-generic SZArrayHelper class.
9016+ //
9017+ if (derivedSig.hasTypeArg ())
9018+ {
9019+ // If we don't know the array type exactly we may have the wrong interface type here.
9020+ // Bail out.
9021+ //
9022+ const bool isArrayInterfaceDevirt = (objClassAttribs & CORINFO_FLG_ARRAY ) != 0 ;
9023+ if (isArrayInterfaceDevirt && !isExact)
9024+ {
9025+ JITDUMP (" Array interface devirt: array type is inexact, sorry.\n " );
9026+ return ;
9027+ }
9028+ }
9029+
90309030 // We still might be able to do a guarded devirtualization.
90319031 // Note the call might be an interface call or a virtual call.
90329032 //
0 commit comments