summaryrefslogtreecommitdiff
path: root/src/jit/flowgraph.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-08-04 19:14:57 -0700
committerGitHub <noreply@github.com>2016-08-04 19:14:57 -0700
commitc4da56ed917793ec1c5100841541d7e17a18f02a (patch)
treeae0ae51316a5275f35b96461613c1e5ed712fb79 /src/jit/flowgraph.cpp
parent400ea0243af9b83d2d506b58effd9cf49176fe23 (diff)
parente3c3330339630f967bdb27c6bcde089e787b2aeb (diff)
downloadcoreclr-c4da56ed917793ec1c5100841541d7e17a18f02a.tar.gz
coreclr-c4da56ed917793ec1c5100841541d7e17a18f02a.tar.bz2
coreclr-c4da56ed917793ec1c5100841541d7e17a18f02a.zip
Merge pull request #6103 from mikedn/nothrowinl
Do not inline methods that never return
Diffstat (limited to 'src/jit/flowgraph.cpp')
-rw-r--r--src/jit/flowgraph.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 25bc4d7edc..4fc28abce8 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -5750,14 +5750,48 @@ void Compiler::fgFindBasicBlocks()
if (compIsForInlining())
{
+ bool hasReturnBlocks = false;
+ bool hasMoreThanOneReturnBlock = false;
+
+ for (BasicBlock* block = fgFirstBB; block != nullptr; block = block->bbNext)
+ {
+ if (block->bbJumpKind == BBJ_RETURN)
+ {
+ if (hasReturnBlocks)
+ {
+ hasMoreThanOneReturnBlock = true;
+ break;
+ }
+
+ hasReturnBlocks = true;
+ }
+ }
+
+ if (!hasReturnBlocks && !compInlineResult->UsesLegacyPolicy())
+ {
+ //
+ // Mark the call node as "no return". The inliner might ignore CALLEE_DOES_NOT_RETURN and
+ // fail inline for a different reasons. In that case we still want to make the "no return"
+ // information available to the caller as it can impact caller's code quality.
+ //
+
+ impInlineInfo->iciCall->gtCallMoreFlags |= GTF_CALL_M_DOES_NOT_RETURN;
+ }
+
+ compInlineResult->NoteBool(InlineObservation::CALLEE_DOES_NOT_RETURN, !hasReturnBlocks);
+
+ if (compInlineResult->IsFailure())
+ {
+ return;
+ }
+
noway_assert(info.compXcptnsCount == 0);
compHndBBtab = impInlineInfo->InlinerCompiler->compHndBBtab;
compHndBBtabAllocCount = impInlineInfo->InlinerCompiler->compHndBBtabAllocCount; // we probably only use the table, not add to it.
compHndBBtabCount = impInlineInfo->InlinerCompiler->compHndBBtabCount;
info.compXcptnsCount = impInlineInfo->InlinerCompiler->info.compXcptnsCount;
- if (info.compRetNativeType != TYP_VOID &&
- fgMoreThanOneReturnBlock())
+ if (info.compRetNativeType != TYP_VOID && hasMoreThanOneReturnBlock)
{
// The lifetime of this var might expand multiple BBs. So it is a long lifetime compiler temp.
lvaInlineeReturnSpillTemp = lvaGrabTemp(false DEBUGARG("Inline candidate multiple BBJ_RETURN spill temp"));