diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index b78299082bd300..56d6ce44c13835 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -3882,6 +3882,10 @@ class Compiler // Note when inlining, this looks for calls back to the root method. bool gtIsRecursiveCall(GenTreeCall* call, bool useInlineRoot = true) { + if (call->gtCallType == CT_INDIRECT) + { + return false; + } return gtIsRecursiveCall(call->gtCallMethHnd, useInlineRoot); } diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 4e437351458b08..fa1b680650e69b 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -9776,6 +9776,7 @@ GenTreeCall* Compiler::gtNewCallNode(gtCallTypes callType, if (callType == CT_INDIRECT) { node->gtCallCookie = nullptr; + node->gtCallMethHnd = NO_METHOD_HANDLE; node->gtControlExpr = (GenTree*)callHnd; } else @@ -11383,7 +11384,8 @@ GenTreeCall* Compiler::gtCloneExprCallHelper(GenTreeCall* tree) /* Copy the union */ if (tree->gtCallType == CT_INDIRECT) { - copy->gtCallCookie = tree->gtCallCookie; + copy->gtCallCookie = tree->gtCallCookie; + copy->gtCallMethHnd = NO_METHOD_HANDLE; } else {