Skip to content

Commit 1f4a061

Browse files
authored
JIT: fix double reporting of some failures in the inline tree (#118902)
We now eagerly create inlinee contexts when we try and inline, so in post-inline debug when we go to scan the trees for the calls that remain, we need to remember which ones were failed inline candidates and which ones we were never inline candidates.
1 parent 2c4708a commit 1f4a061

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/coreclr/jit/fginline.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,10 @@ void Compiler::fgMorphCallInline(GenTreeCall* call, InlineResult* inlineResult)
10211021
inliningFailed = true;
10221022

10231023
// Clear the Inline Candidate flag so we can ensure later we tried
1024-
// inlining all candidates.
1024+
// inlining all candidates. In debug, remember that this was an inline candidate.
10251025
//
10261026
call->gtFlags &= ~GTF_CALL_INLINE_CANDIDATE;
1027+
INDEBUG(call->SetWasInlineCandidate());
10271028
}
10281029
}
10291030
else
@@ -1233,7 +1234,7 @@ Compiler::fgWalkResult Compiler::fgFindNonInlineCandidate(GenTree** pTree, fgWal
12331234

12341235
void Compiler::fgNoteNonInlineCandidate(Statement* stmt, GenTreeCall* call)
12351236
{
1236-
if (call->IsInlineCandidate() || call->IsGuardedDevirtualizationCandidate())
1237+
if (call->IsInlineCandidate() || call->IsGuardedDevirtualizationCandidate() || call->WasInlineCandidate())
12371238
{
12381239
return;
12391240
}

src/coreclr/jit/gentree.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4304,7 +4304,8 @@ enum GenTreeCallDebugFlags : unsigned int
43044304
GTF_CALL_MD_DEVIRTUALIZED = 0x00000002, // this call was devirtualized
43054305
GTF_CALL_MD_UNBOXED = 0x00000004, // this call was optimized to use the unboxed entry point
43064306
GTF_CALL_MD_GUARDED = 0x00000008, // this call was transformed by guarded devirtualization
4307-
GTF_CALL_MD_RUNTIME_LOOKUP_EXPANDED = 0x00000010, // this runtime lookup helper is expanded
4307+
GTF_CALL_MD_WAS_CANDIDATE = 0x00000010, // this call is a (failed) inline candidate
4308+
GTF_CALL_MD_RUNTIME_LOOKUP_EXPANDED = 0x00000020, // this runtime lookup helper is expanded
43084309
};
43094310

43104311
inline constexpr GenTreeCallDebugFlags operator ~(GenTreeCallDebugFlags a)
@@ -5556,6 +5557,11 @@ struct GenTreeCall final : public GenTree
55565557
{
55575558
return (gtCallDebugFlags & GTF_CALL_MD_UNBOXED) != 0;
55585559
}
5560+
5561+
bool WasInlineCandidate() const
5562+
{
5563+
return (gtCallDebugFlags & GTF_CALL_MD_WAS_CANDIDATE) != 0;
5564+
}
55595565
#endif
55605566

55615567
bool IsSuppressGCTransition() const
@@ -5573,6 +5579,11 @@ struct GenTreeCall final : public GenTree
55735579
{
55745580
gtCallDebugFlags |= GTF_CALL_MD_GUARDED;
55755581
}
5582+
5583+
void SetWasInlineCandidate()
5584+
{
5585+
gtCallDebugFlags |= GTF_CALL_MD_WAS_CANDIDATE;
5586+
}
55765587
#endif
55775588

55785589
void SetExpandedEarly()

0 commit comments

Comments
 (0)