Description
It seems that inlining decisions made in cold code blocks are being remembered by JIT and blindly used later in completely unrelated methods.
Reproduction Steps
https://godbolt.org/z/9zas8rc6h
Expected behavior
C:InnocentMethod implicitly converts the provided Span into a ReadOnlySpan without using a op_Implicit call.
Actual behavior
Trivially inline-able methods (even intrinsic methods) are not inlined in normal methods.
Regression?
.NET 7 seems to not have this issue.
Known Workarounds
No reliable workarounds, can reduce chances by avoiding any potential inlining in cold code blocks or re-ordering method JIT compilation order.
Description
It seems that inlining decisions made in cold code blocks are being remembered by JIT and blindly used later in completely unrelated methods.
Reproduction Steps
https://godbolt.org/z/9zas8rc6h
Expected behavior
C:InnocentMethodimplicitly converts the provided Span into a ReadOnlySpan without using aop_Implicitcall.Actual behavior
Trivially inline-able methods (even intrinsic methods) are not inlined in normal methods.
Regression?
.NET 7 seems to not have this issue.
Known Workarounds
No reliable workarounds, can reduce chances by avoiding any potential inlining in cold code blocks or re-ordering method JIT compilation order.