Skip to content

JIT: Remove BBF_FUNCLET_BEG#113975

Merged
amanasifkhalid merged 5 commits intodotnet:mainfrom
amanasifkhalid:bbf-cleanup
Mar 31, 2025
Merged

JIT: Remove BBF_FUNCLET_BEG#113975
amanasifkhalid merged 5 commits intodotnet:mainfrom
amanasifkhalid:bbf-cleanup

Conversation

@amanasifkhalid
Copy link
Contributor

BBF_FUNCLET_BEG is set for the first block in each filter/handler region when we have funclets; this state can already be checked with Compiler::bbIsHandlerBeg. This PR replaces BBF_FUNCLET_BEG with a new helper method Compiler::bbIsFuncletBeg, which is identical in behavior to bbIsHandlerBeg when we have funclets, and (what should be) a const-evaluated return false when we don't use funclets at all.

This was a no-diff change locally, though it does enable compaction of the first block in a handler region -- I don't see why such a transformation should be illegal.

Copilot AI review requested due to automatic review settings March 27, 2025 16:49
Copy link
Contributor

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.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (17)
  • src/coreclr/jit/block.cpp: Language not supported
  • src/coreclr/jit/block.h: Language not supported
  • src/coreclr/jit/codegenarm.cpp: Language not supported
  • src/coreclr/jit/codegenarm64.cpp: Language not supported
  • src/coreclr/jit/codegencommon.cpp: Language not supported
  • src/coreclr/jit/codegenlinear.cpp: Language not supported
  • src/coreclr/jit/codegenloongarch64.cpp: Language not supported
  • src/coreclr/jit/codegenriscv64.cpp: Language not supported
  • src/coreclr/jit/codegenxarch.cpp: Language not supported
  • src/coreclr/jit/compiler.h: Language not supported
  • src/coreclr/jit/compiler.hpp: Language not supported
  • src/coreclr/jit/emit.cpp: Language not supported
  • src/coreclr/jit/fgbasic.cpp: Language not supported
  • src/coreclr/jit/fgdiagnostic.cpp: Language not supported
  • src/coreclr/jit/fgopt.cpp: Language not supported
  • src/coreclr/jit/jiteh.cpp: Language not supported
  • src/coreclr/jit/scopeinfo.cpp: Language not supported

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 27, 2025
@dotnet-policy-service
Copy link
Contributor

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

@amanasifkhalid
Copy link
Contributor Author

@dotnet/jit-contrib PTAL. No diffs from the last run. I had to make a few changes that seem gratuitous to keep MinOpts TP from regressing. Thanks!

bool firstMapping = true;

if (block->HasFlag(BBF_FUNCLET_BEG))
const bool isFuncletBeg = compiler->UsesFunclets() && compiler->bbIsHandlerBeg(block);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const bool isFuncletBeg = compiler->UsesFunclets() && compiler->bbIsHandlerBeg(block);
const bool isFuncletBeg = compiler->bbIsFuncletBeg(block);

//
bool Compiler::bbIsFuncletBeg(const BasicBlock* block)
{
if (UsesFunclets() && fgFuncletsCreated)
Copy link
Member

Choose a reason for hiding this comment

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

Should we even be asking this if fgFuncletsCreated is false?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps rearrange so we assert(fgFuncletsCreated); under if(UsesFunclets())?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I started working on this, we had some paths where we would check for funclet start blocks before and after funclets were created, like in fgCanCompactBlock. I've since been able to remove these checks, so we can make the fgFuncletsCreated check an invariant.

@amanasifkhalid
Copy link
Contributor Author

/ba-g timeouts on Azure Linux 3

@amanasifkhalid
Copy link
Contributor Author

Still no diffs

@amanasifkhalid amanasifkhalid merged commit bee9dd2 into dotnet:main Mar 31, 2025
109 of 111 checks passed
@amanasifkhalid amanasifkhalid deleted the bbf-cleanup branch March 31, 2025 13:25
thaystg pushed a commit to thaystg/runtime that referenced this pull request Apr 1, 2025
BBF_FUNCLET_BEG is set for the first block in each filter/handler region when we have funclets; this state can already be checked with Compiler::bbIsHandlerBeg. This PR replaces BBF_FUNCLET_BEG with a new helper method Compiler::bbIsFuncletBeg, which is identical in behavior to bbIsHandlerBeg when we have funclets, and (what should be) a const-evaluated return false when we don't use funclets at all.

This was a no-diff change locally, though it does enable compaction of the first block in a handler region -- I don't see why such a transformation should be illegal.
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 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

Comments