[Testing] stackalloc arrays contain gcrefs#110925
Closed
hez2010 wants to merge 83 commits intodotnet:mainfrom
Closed
[Testing] stackalloc arrays contain gcrefs#110925hez2010 wants to merge 83 commits intodotnet:mainfrom
hez2010 wants to merge 83 commits intodotnet:mainfrom
Conversation
These flags are strictly optimizations. Having them required to be set for certain indirs based on context of the operand introduces IR invariants that are annoying to work with since it suddenly becomes necessary for all transformations to consider "did we just introduce this IR shape?". Instead, handle these patterns during morph as the optimization it is and remove the strict flags checking from `fgDebugCheckFlags`.
This reverts commit 1914e80.
Contributor
Author
62fea53 to
3f49798
Compare
Contributor
Author
|
@EgorBot -amd -arm -profiler using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
public class Benchmark
{
[Benchmark]
public void Bench()
{
var points = new[]
{
new Point(1, 2, 3),
new Point(5, 4, 6),
new Point(9, 8, 7),
};
double area = 0.5 * Math.Abs(
points[0].X * (points[1].Y - points[2].Y) +
points[1].X * (points[2].Y - points[0].Y) +
points[2].X * (points[0].Y - points[1].Y));
Use(area);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Use(double value) { }
record Point(double X, double Y, double Z);
} |
Contributor
Author
|
This shares the same issue with field-wise analysis: we need to be careful with ind/blk load/store when field/index address is involved, which makes the analysis more conservative so that there will be fewer opportunities. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing stackalloc arrays contain gcrefs.
We can allocate an array of pointers instead of flatting the whole content on the stack. Not sure about the gc report issue here.
The analysis is not correct currently, but I'm opening a PR to check the diff we can potentially have.