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

Remove O1K_VALUE_NUMBER #101894

Merged
merged 1 commit into from
May 8, 2024
Merged

Remove O1K_VALUE_NUMBER #101894

merged 1 commit into from
May 8, 2024

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented May 6, 2024

I am seeing some nice diffs in libraries.pmi from this change.

My understanding that when we try to create an assertion for lcl != null (where lcl is a TYP_BYREF) - we try to find the underlying TYP_REF in that TYP_BYREF (e.g. BYREF = TYP_REF + smallCns) and then create a O1K_VALUE_NUMBER assertion for that TYP_REF or bail out.

My PR removes that assertion completely so we just create "byref lcl != null" O1K_LCLVAR assertion without trying to find the TYP_REF. There are a few regressions, but mostly improvements.

E.g. it helps to fold things like:

***** BB01 [0000]
STMT00011
N002 (  2,  2) [000080] ---X-O-----                         *  NULLCHECK byte   $181
N001 (  1,  1) [000079] -----------                         \--*  LCL_VAR   byref  V03 tmp1         u:1 $140

***** BB01 [0000]
STMT00012
N004 (  5,  5) [000050] -----------                         *  JTRUE     void   $VN.Void
N003 (  3,  3) [000047] J------N---                         \--*  NE        int    $1c0
N001 (  1,  1) [000039] -----------                            +--*  LCL_VAR   byref  V03 tmp1         u:1 $140
N002 (  1,  1) [000046] -----------                            \--*  CNS_INT   byref  0 

@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 May 6, 2024
Copy link
Contributor

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

@EgorBo
Copy link
Member Author

EgorBo commented May 6, 2024

PTAL @AndyAyersMS @jakobbotsch @dotnet/jit-contrib
Diffs. A couple of regressions where this assertion was useful, but in most cases "byref != null" was better.

@AndyAyersMS
Copy link
Member

Does it make sense to assert non-null for both the byref value and the base value? I suppose the issue is on the checking side we're not doing the same add destructuring (which likely is somewhat reasonable, we probably do a lot more checking/searching then generating).

Looking at the removed code I am surprised it has to check for chains of adds. Does that mean VN is producing VN func trees of adds -- I would expect it ought to be folding up all the constant offsets into one? That would make it simpler to find the byref base as it should be right there (and given canonical commutation, always be say arg0.).

@EgorBo
Copy link
Member Author

EgorBo commented May 7, 2024

Does it make sense to assert non-null for both the byref value and the base value?

@AndyAyersMS My initial impl did exactly that but it's extra assertions and the benifts were small, Do you mind if I try again (with help of VN this time) to add assertions for base separately? So we can see actual diffs + TP impact

@AndyAyersMS
Copy link
Member

Does it make sense to assert non-null for both the byref value and the base value?

@AndyAyersMS My initial impl did exactly that but it's extra assertions and the benifts were small, Do you mind if I try again (with help of VN this time) to add assertions for base separately? So we can see actual diffs + TP impact

Yeah go ahead and give it a try.

@EgorBo
Copy link
Member Author

EgorBo commented May 7, 2024

Does it make sense to assert non-null for both the byref value and the base value?

@AndyAyersMS My initial impl did exactly that but it's extra assertions and the benifts were small, Do you mind if I try again (with help of VN this time) to add assertions for base separately? So we can see actual diffs + TP impact

Yeah go ahead and give it a try.

Waiting for an approval then 🙂

@AndyAyersMS
Copy link
Member

Ah, you mean in a follow-up PR... Sure

@EgorBo EgorBo merged commit 3fce4e7 into dotnet:main May 8, 2024
107 checks passed
@EgorBo EgorBo deleted the remove-vn-assertion branch May 8, 2024 11:30
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
@LoopedBard3
Copy link
Member

LoopedBard3 commented May 14, 2024

Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
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.

3 participants