Skip to content

JIT: Add a gtFindNodeInTree helper #115975

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

jakobbotsch
Copy link
Member

Add a gtFindNodeInTree helper to find a node in a tree matching a predicate, and use it in a couple of places

Add a gtFindNodeInTree helper to find a node in a tree matching a
predicate, and use it in a couple of places
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 25, 2025
Copy link
Contributor

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

@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib. No diffs, just adding a helper and replacing a few places to use it.

@jakobbotsch jakobbotsch requested a review from a team May 27, 2025 14:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Introduces a generic gtFindNodeInTree helper to replace several bespoke tree‐walking visitors for finding nodes by predicate.

  • Adds the gtFindNodeInTree template in compiler.hpp with flags-based subtree filtering.
  • Refactors existing gtTreeContains* and custom visitor usages to call gtFindNodeInTree.
  • Eliminates duplicated visitor classes from gschecks.cpp, gentree.cpp, and fgopt.cpp.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
compiler.hpp Added gtFindNodeInTree template declaration
gschecks.cpp Replaced custom GenTreeVisitor with gtFindNodeInTree
gentree.cpp Swapped out gtTreeContainsOper visitor for helper
fgopt.cpp Replaced gtTreeContainsCall patterns with helper
compiler.h Removed obsolete gtTreeContainsCall declaration, added helper declaration

@jakobbotsch
Copy link
Member Author

/ba-g Timeout is #115955

@jakobbotsch jakobbotsch merged commit db27700 into dotnet:main May 28, 2025
107 of 109 checks passed
@jakobbotsch jakobbotsch deleted the gtFindNodeInTree-helper branch May 28, 2025 10:04
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2025
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