Skip to content

JIT: Remove fgFirstColdBlock checks in frontend phases#110452

Merged
amanasifkhalid merged 1 commit into
dotnet:mainfrom
amanasifkhalid:fgFirstColdBlock-checks
Dec 6, 2024
Merged

JIT: Remove fgFirstColdBlock checks in frontend phases#110452
amanasifkhalid merged 1 commit into
dotnet:mainfrom
amanasifkhalid:fgFirstColdBlock-checks

Conversation

@amanasifkhalid

Copy link
Copy Markdown
Contributor

Part of #107749. Now that hot/cold splitting runs after layout in the backend, where the flowgraph is expected to never change, we shouldn't need to check for the presence of a cold code section in the frontend.

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 5, 2024
@amanasifkhalid

Copy link
Copy Markdown
Contributor Author

/azp run runtime-jit-experimental

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Comment thread src/coreclr/jit/fgopt.cpp
}

// can't allow fall through into cold code
if (block->IsLastHotBlock(this))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This check looks like it wouldn't pessimize anything if we aren't hot/cold splitting, but IsLastHotBlock returns true if block == fgLastBB too, so this check was blocking empty block removal for the last block in the worklist. Thus, the check's removal incurs some small diffs. PerfScore diffs look wonky due to churn in optSetBlockWeights, but the actual layout diffs look like an improvement.

@amanasifkhalid

Copy link
Copy Markdown
Contributor Author

cc @dotnet/jit-contrib, @AndyAyersMS PTAL. runtime-jit-experimental failures are unrelated. Small diffs for reasons explained above. TP improvements seem to stem not just from the removed checks, but from the simplifications I made to BasicBlock::CanRemoveJumpToTarget. There's some outlier TP regression on Linux ARM that I thought was due to native compilers making different inlining decisions, but the regression is only in coreclr_tests MinOpts -- not sure what's going on there.

@amanasifkhalid amanasifkhalid merged commit 637e822 into dotnet:main Dec 6, 2024
@amanasifkhalid amanasifkhalid deleted the fgFirstColdBlock-checks branch December 6, 2024 19:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 6, 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