diff options
author | Andy Ayers <andya@microsoft.com> | 2016-11-09 15:03:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-09 15:03:23 -0800 |
commit | e76da565c106016d604b95f3bb7eadd24ceaf18a (patch) | |
tree | 0c4e1cb7bb22e98d8e286055e6c5a2eedea5a959 | |
parent | a67530b73c422e0158221dde74f2cb38d2aa8d33 (diff) | |
download | coreclr-e76da565c106016d604b95f3bb7eadd24ceaf18a.tar.gz coreclr-e76da565c106016d604b95f3bb7eadd24ceaf18a.tar.bz2 coreclr-e76da565c106016d604b95f3bb7eadd24ceaf18a.zip |
Inliner: enable inlining of methods with conditional throws (#8038)
* Inliner: enable inlining of methods with conditional throws
Remove inlining limitation for methods that return values and have
conditional throws. This limitation was most likely a vestige of an
older inlining implementation that did not break trees at inline
call sites.
Also removed the now-unused observation and the `seenConditionalJump`
member variable. Merged ifdef blocks in `impInit`.
Ran full desktop testing, no issues.
Enables a handful of inlines in the various code size suites. For the
most part these slightly increase code size but can often shorten the
non-EH paths in the code.
-rw-r--r-- | src/jit/compiler.h | 2 | ||||
-rw-r--r-- | src/jit/importer.cpp | 25 | ||||
-rw-r--r-- | src/jit/inline.def | 1 |
3 files changed, 3 insertions, 25 deletions
diff --git a/src/jit/compiler.h b/src/jit/compiler.h index 80dc6507ab..8f36820b99 100644 --- a/src/jit/compiler.h +++ b/src/jit/compiler.h @@ -3205,8 +3205,6 @@ private: static LONG jitNestingLevel; #endif // DEBUG - bool seenConditionalJump; - static BOOL impIsAddressInLocal(GenTreePtr tree, GenTreePtr* lclVarTreeOut); void impMakeDiscretionaryInlineObservations(InlineInfo* pInlineInfo, InlineResult* inlineResult); diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index 2555e1f9c4..5709818ba9 100644 --- a/src/jit/importer.cpp +++ b/src/jit/importer.cpp @@ -63,15 +63,12 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX void Compiler::impInit() { -#ifdef DEBUG - impTreeList = impTreeLast = nullptr; -#endif -#if defined(DEBUG) +#ifdef DEBUG + impTreeList = nullptr; + impTreeLast = nullptr; impInlinedCodeSize = 0; #endif - - seenConditionalJump = false; } /***************************************************************************** @@ -11113,8 +11110,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) COND_JUMP: - seenConditionalJump = true; - /* Fold comparison if we can */ op1 = gtFoldExpr(op1); @@ -14153,20 +14148,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) compInlineResult->NoteFatal(InlineObservation::CALLEE_THROW_WITH_INVALID_STACK); return; } - - /* Don't inline non-void conditionals that have a throw in one of the branches */ - - /* NOTE: If we do allow this, note that we can't simply do a - checkLiveness() to match the liveness at the end of the "then" - and "else" branches of the GT_COLON. The branch with the throw - will keep nothing live, so we should use the liveness at the - end of the non-throw branch. */ - - if (seenConditionalJump && (impInlineInfo->inlineCandidateInfo->fncRetType != TYP_VOID)) - { - compInlineResult->NoteFatal(InlineObservation::CALLSITE_CONDITIONAL_THROW); - return; - } } if (tiVerificationNeeded) diff --git a/src/jit/inline.def b/src/jit/inline.def index 991d87458e..d0e013700e 100644 --- a/src/jit/inline.def +++ b/src/jit/inline.def @@ -122,7 +122,6 @@ INLINE_OBSERVATION(CANT_EMBED_VARARGS_COOKIE, bool, "can't embed varargs cooki INLINE_OBSERVATION(CLASS_INIT_FAILURE_SPEC, bool, "speculative class init failed", FATAL, CALLSITE) INLINE_OBSERVATION(COMPILATION_ERROR, bool, "compilation error", FATAL, CALLSITE) INLINE_OBSERVATION(COMPILATION_FAILURE, bool, "failed to compile", FATAL, CALLSITE) -INLINE_OBSERVATION(CONDITIONAL_THROW, bool, "conditional throw", FATAL, CALLSITE) INLINE_OBSERVATION(CROSS_BOUNDARY_CALLI, bool, "cross-boundary calli", FATAL, CALLSITE) INLINE_OBSERVATION(CROSS_BOUNDARY_SECURITY, bool, "cross-boundary security check", FATAL, CALLSITE) INLINE_OBSERVATION(EXCEEDS_THRESHOLD, bool, "exceeds profit threshold", FATAL, CALLSITE) |