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

JIT: enhance SSA checker to check some PHI properties #85533

Merged
merged 2 commits into from
Apr 28, 2023

Conversation

AndyAyersMS
Copy link
Member

  • Ensure PhiArgs have the right local number.
  • Ensure PhiArgs have unique gtPredBB (for most blocks)

Handler entries may have multiple PhiArgs with the same gtPredBB. This is by design, to model exceptional flow from the middle of the block to a handler.

Jump threading relies on there being just a single PhiArg per pred. So exclude handler entry blocks from jump threading.

Prep work for possibly changing SSA to produce one PhiArg per pred, instead of one PhiArg per ssa def.

* Ensure PhiArgs have the right local number.
* Ensure PhiArgs have unique `gtPredBB` (for most blocks)

Handler entries may have multiple PhiArgs with the same `gtPredBB`. This
is by design, to model exceptional flow from the middle of the block to a
handler.

Jump threading relies on there being just a single PhiArg per pred.
So exclude handler entry blocks from jump threading.

Prep work for possibly changing SSA to produce one PhiArg per pred, instead
of one PhiArg per ssa def.
@ghost ghost assigned AndyAyersMS Apr 28, 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 Apr 28, 2023
@ghost
Copy link

ghost commented Apr 28, 2023

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

Issue Details
  • Ensure PhiArgs have the right local number.
  • Ensure PhiArgs have unique gtPredBB (for most blocks)

Handler entries may have multiple PhiArgs with the same gtPredBB. This is by design, to model exceptional flow from the middle of the block to a handler.

Jump threading relies on there being just a single PhiArg per pred. So exclude handler entry blocks from jump threading.

Prep work for possibly changing SSA to produce one PhiArg per pred, instead of one PhiArg per ssa def.

Author: AndyAyersMS
Assignees: AndyAyersMS
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

No diffs expected.

Comment on lines 4208 to 4213
for (Statement* const stmt : block->Statements())
{
if (!stmt->IsPhiDefnStmt())
{
break;
}
Copy link
Member

Choose a reason for hiding this comment

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

We already have NonPhiStatements(); maybe we should have PhiStatements()? (Presumably somebody else would verify all the PHI statements appear first).

Suggested change
for (Statement* const stmt : block->Statements())
{
if (!stmt->IsPhiDefnStmt())
{
break;
}
for (Statement* const stmt : block->PhiStatements())
{

Copy link
Member Author

Choose a reason for hiding this comment

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

I should probably check that all the PhiDefs appear first, but then I wouldn't need the partial iterator.

@AndyAyersMS
Copy link
Member Author

Failure looks similar to #85082 but the pattern there is different.

CSC : error CS8034: Unable to load Analyzer assembly /__w/1/s/.dotnet/sdk/8.0.100-preview.3.23178.7/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll : The file '/tmp/VBCSCompiler/AnalyzerAssemblyLoader/a6fe1c15dfaa4493b9e3eda990245fe8/30' already exists. [/__w/1/s/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.csproj] [/__w/1/s/src/tests/build.proj]

@AndyAyersMS AndyAyersMS merged commit e482bba into dotnet:main Apr 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 29, 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