Bernd Baumanns
Bernd Baumanns
> Right, then it can't be optimized out. The result should be the same. @jaredpar could you explain the situation when it can't be optimized out? The inline array is...
> What if the user has disabled locals init behavior and are using the defaults to force initialization? That doesn't matter because the inline-array-struct is explicitly defaulted. If it wouldn't...
> What are the very specific cases this would apply to and why is it demonstrably safe in all those cases? I mean this [use case](https://sharplab.io/#v2:EYLgtghglgdgPgAQEwEYCwAoBAGABAlAOgEkB5Abk0wGUAXAJwFMIxcBnAezEbqZdwC8uGAFcANmMoZqABwgwAPMACetRgD52kCQCERAM32N6g3AG1sAGis3rd29gC6Uzt17MwhAErMAJgAo2bTE9Q2MASnIgA==): ```csharp using System; using...
> why is it demonstrably safe in all those cases Because we do: ```csharp default(y__InlineArray9) ```
If I would use stackalloc the generated code looks much better, but it coulde issues with inlining or in loops... ```csharp using System; using System.IO; Stream someStream = null; Span...
I actually did a benchmark for this specific use case and observed that such unnecessary assignments to defaulted struct-fields are optimized away by the runtime (for Release builds) as long...
The benchmark code I used was: ```csharp using System; using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; var config = DefaultConfig.Instance; var summary = BenchmarkRunner.Run (config, args); [DisassemblyDiagnoser] //[RPlotExporter] [SimpleJob(runtimeMoniker:...
@AlekseyTs do you have an idea for a test?
@AlekseyTs can you write a test or help me to do so for the linked issue. I explain what I would want to test: compile and execute the following code:...
I added the following test method: ```csharp [Fact] public void TestRefConditionalWithSpilling() { var source = """ class C { public static void Main() { string str = "a2"; int x...