summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2017-09-15 13:34:21 -0700
committerGitHub <noreply@github.com>2017-09-15 13:34:21 -0700
commit776b2bf39f3ef429d9e92633d3de4337f8b42bfc (patch)
tree0cb1509fd04281b0b6e553af56c51bb578269bc2 /src
parent984bcfb3083e1ce944e07e28d259b08ef2e21818 (diff)
downloadcoreclr-776b2bf39f3ef429d9e92633d3de4337f8b42bfc.tar.gz
coreclr-776b2bf39f3ef429d9e92633d3de4337f8b42bfc.tar.bz2
coreclr-776b2bf39f3ef429d9e92633d3de4337f8b42bfc.zip
Fix check for recursive call in the importer. (#13990)
The check for recursive call was incorrect when processing an inlineee. The change had no diffs with jit-diff --frameworks --tests so I added a test where this change results in a codegen diff: the call to C is inlined with this change but is not inlined without it.
Diffstat (limited to 'src')
-rw-r--r--src/jit/compiler.h7
-rw-r--r--src/jit/importer.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 86917d9481..7c99a6985a 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -2218,7 +2218,12 @@ public:
// Note when inlining, this looks for calls back to the root method.
bool gtIsRecursiveCall(GenTreeCall* call)
{
- return (call->gtCallMethHnd == impInlineRoot()->info.compMethodHnd);
+ return gtIsRecursiveCall(call->gtCallMethHnd);
+ }
+
+ bool gtIsRecursiveCall(CORINFO_METHOD_HANDLE callMethodHandle)
+ {
+ return (callMethodHandle == impInlineRoot()->info.compMethodHnd);
}
//-------------------------------------------------------------------------
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 580e2b85f1..90d1618f2e 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -6993,7 +6993,7 @@ var_types Compiler::impImportCall(OPCODE opcode,
exactContextNeedsRuntimeLookup = callInfo->exactContextNeedsRuntimeLookup == TRUE;
// Recursive call is treated as a loop to the begining of the method.
- if (methHnd == info.compMethodHnd)
+ if (gtIsRecursiveCall(methHnd))
{
#ifdef DEBUG
if (verbose)