From 179ce473813d98437f1515c327b762ed1edac76e Mon Sep 17 00:00:00 2001 From: EgorBo Date: Sat, 7 Oct 2023 23:57:46 +0200 Subject: [PATCH] Clean up --- src/coreclr/jit/compiler.h | 1 - src/coreclr/jit/hwintrinsic.cpp | 10 ++++------ src/coreclr/jit/importercalls.cpp | 9 +++++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 3cae93c1e4dafa..5980df74aa1f4c 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -2810,7 +2810,6 @@ class Compiler GenTreeHWIntrinsic* gtNewScalarHWIntrinsicNode( var_types type, GenTree* op1, GenTree* op2, GenTree* op3, NamedIntrinsic hwIntrinsicID); CorInfoType getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, - CORINFO_CLASS_HANDLE clsHnd, CORINFO_SIG_INFO* sig, CorInfoType simdBaseJitType); diff --git a/src/coreclr/jit/hwintrinsic.cpp b/src/coreclr/jit/hwintrinsic.cpp index a0496737343a52..53a35af9dd3644 100644 --- a/src/coreclr/jit/hwintrinsic.cpp +++ b/src/coreclr/jit/hwintrinsic.cpp @@ -359,7 +359,6 @@ const TernaryLogicInfo& TernaryLogicInfo::lookup(uint8_t control) // // Arguments: // intrinsic -- id of the intrinsic function. -// clsHnd -- class handle containing the intrinsic function. // method -- method handle of the intrinsic function. // sig -- signature of the intrinsic call. // simdBaseJitType -- Predetermined simdBaseJitType, could be CORINFO_TYPE_UNDEF @@ -367,10 +366,9 @@ const TernaryLogicInfo& TernaryLogicInfo::lookup(uint8_t control) // Return Value: // The basetype of intrinsic of it can be fetched from 1st or 2nd argument, else return baseType unmodified. // -CorInfoType Compiler::getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_SIG_INFO* sig, - CorInfoType simdBaseJitType) +CorInfoType Compiler::getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, + CORINFO_SIG_INFO* sig, + CorInfoType simdBaseJitType) { if (HWIntrinsicInfo::BaseTypeFromSecondArg(intrinsic) || HWIntrinsicInfo::BaseTypeFromFirstArg(intrinsic)) { @@ -1088,7 +1086,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, } } - simdBaseJitType = getBaseJitTypeFromArgIfNeeded(intrinsic, clsHnd, sig, simdBaseJitType); + simdBaseJitType = getBaseJitTypeFromArgIfNeeded(intrinsic, sig, simdBaseJitType); if (simdBaseJitType == CORINFO_TYPE_UNDEF) { diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 9d92da20126b36..ec86bd5dda89ab 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -191,10 +191,15 @@ var_types Compiler::impImportCall(OPCODE opcode, } } - clsHnd = pResolvedToken->hClass; - + clsHnd = pResolvedToken->hClass; clsFlags = callInfo->classFlags; + // if clsHnd is an interface and method is static, try to get the actual implementation class + if ((clsFlags & CORINFO_FLG_INTERFACE) != 0 && (clsFlags & CORINFO_FLG_INTERFACE) != 0) + { + clsHnd = info.compCompHnd->getMethodClass(methHnd); + } + #ifdef DEBUG // If this is a call to JitTestLabel.Mark, do "early inlining", and record the test attribute.