-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Testing] stackalloc arrays contain gcrefs #110925
Closed
Closed
Conversation
This file contains 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
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.
dotnet-issue-labeler
bot
added
the
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
label
Dec 24, 2024
hez2010
changed the title
[Testing] stackalloc arrays contains gcrefs
[Testing] stackalloc arrays contain gcrefs
Dec 24, 2024
dotnet-policy-service
bot
added
the
community-contribution
Indicates that the PR has been added by a community member
label
Dec 24, 2024
hez2010
force-pushed
the
array-stack-alloc
branch
from
December 24, 2024 08:24
62fea53
to
3f49798
Compare
@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);
} |
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
community-contribution
Indicates that the PR has been added by a community member
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.