Skip to content
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

Convert JitHashTable iteration to range-based for #80265

Conversation

BruceForstall
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 5, 2023
@ghost ghost assigned BruceForstall Jan 5, 2023
@ghost
Copy link

ghost commented Jan 5, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: BruceForstall
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@BruceForstall BruceForstall marked this pull request as ready for review January 6, 2023 02:33
@BruceForstall
Copy link
Member Author

No diffs (as expected) but TP improvements around 0.22%

@BruceForstall
Copy link
Member Author

@dotnet/jit-contrib PTAL

@@ -11312,10 +11309,9 @@ void Compiler::JitTestCheckVN()
{
printf("\nJit Testing: Value numbering.\n");
}
for (NodeToTestDataMap::KeyIterator ki = testData->Begin(); !ki.Equal(testData->End()); ++ki)
for (GenTree* const node : NodeToTestDataMap::KeyIteration(testData))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, we could simplify a lot of this by declaring something like the following in NodeToTestDataMap

public:
    using const_iterator = NodeToTestDataMap::KeyIteration;

That should allow simply for (GenTree* const node : testData) which is a lot simpler and doesn't require line wrapping/etc

Provided we don't need multiple iterators dealing with the same type, everything should work out nicely.

We should likewise be able to annotate whether they are "random access" or "contiguous" if that is important.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, looks like it just needs begin and end

The using iterator and using const_iterator can also help with some templating and other scenarios, but aren't strictly required to use for (T item : data)

@BruceForstall BruceForstall merged commit 42a82dd into dotnet:main Jan 6, 2023
@BruceForstall BruceForstall deleted the ConvertJitHashTableIteratorToRangeBasedFor2 branch January 6, 2023 19:55
@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants