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

Reduce differences between successor iterators #93445

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

BruceForstall
Copy link
Member

The NumSucc/GetSucc/Succs iterators have two variants. It is hard to understand the distinction. The goal of this change is to reduce the differences, so the only difference is the SWITCH case (iterating either all successors or only unique successors).

So:

  1. BBJ_EHFILTERRET: always return the single successor, which is the first block of the filter handler.
  2. BBJ_EHFINALLYRET: Move to standard successor iterator

@ghost ghost assigned BruceForstall Oct 13, 2023
@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 Oct 13, 2023
@ghost
Copy link

ghost commented Oct 13, 2023

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

Issue Details

The NumSucc/GetSucc/Succs iterators have two variants. It is hard to understand the distinction. The goal of this change is to reduce the differences, so the only difference is the SWITCH case (iterating either all successors or only unique successors).

So:

  1. BBJ_EHFILTERRET: always return the single successor, which is the first block of the filter handler.
  2. BBJ_EHFINALLYRET: Move to standard successor iterator
Author: BruceForstall
Assignees: BruceForstall
Labels:

area-CodeGen-coreclr

Milestone: -

@BruceForstall
Copy link
Member Author

@AndyAyersMS PTAL
cc @dotnet/jit-contrib

@@ -11528,22 +11528,30 @@ void Compiler::impImportBlock(BasicBlock* block)
impReimportSpillClique(block);

// For blocks that haven't been imported yet, we still need to mark them as pending import.
for (BasicBlock* const succ : block->Succs())
// Filter successor from BBJ_EHFILTERRET have already been handled, above.
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't figure out where the "above" was. Would be nice to avoid this special case.

Seems like we should never get into the spill clique case for filters since the exit stack will be emtpy?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I can remove this from the spill clique case if you think it's unnecessary. (Just assert block is not a filterret?) I was just being defensive, since I hit an assert without this in the "normal" case.

The NumSucc/GetSucc/Succs iterators have two variants. It is hard to understand
the distinction. The goal of this change is to reduce the differences,
so the only difference is the SWITCH case (iterating either all successors
or only unique successors).

So:
1. BBJ_EHFILTERRET: always return the single successor, which is the first
block of the filter handler.
2. BBJ_EHFINALLYRET: Move to standard successor iterator
@BruceForstall
Copy link
Member Author

@AndyAyersMS updated

@BruceForstall BruceForstall merged commit 3d995ec into dotnet:main Oct 13, 2023
127 of 129 checks passed
@BruceForstall BruceForstall deleted the SimplifySuccessorIteration branch October 13, 2023 19:46
@ghost ghost locked as resolved and limited conversation to collaborators Nov 13, 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