You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JIT is able to produce exactly the same thing for both, but the IL for the former is more complicated and requires the compiler synthesize the <>y__InlineArray1<T> type if it wouldn't otherwise be necessary.
The text was updated successfully, but these errors were encountered:
I think the compiler should still create a temp here to pass by-ref to the span constructor. The ReadOnlySpan in the original sample should not hold a reference to x. Otherwise, the behavior is in violation of the spec, when x is reassigned before the ReadOnlySpan is used.
The JIT can likely eliminate the temp when it can see that the original variable is not reassigned while the ReadOnlySpan is live.
Version Used:
d8d7886
Steps to Reproduce:
SharpLab
Expected Behavior:
M1 and M2 could produce identical IL.
Actual Behavior:
The IL generated is more akin to:
The JIT is able to produce exactly the same thing for both, but the IL for the former is more complicated and requires the compiler synthesize the
<>y__InlineArray1<T>
type if it wouldn't otherwise be necessary.The text was updated successfully, but these errors were encountered: