Skip to content

Conversation

jakobbotsch
Copy link
Member

For a lot of extremely common binary VN functions we do a series of
unnecessary folding checks, in particular VNF_ValWithExc and
VNF_ExcSetCons. Introduce a VNForFuncNoFolding and
VNPairForFuncNoFolding that bypasses folding and use it in some cases.

For a lot of extremely common binary VN functions we do a series of
unnecessary folding checks, in particular VNF_ValWithExc and
VNF_ExcSetCons. Introduce a VNForFuncNoFolding and
VNPairForFuncNoFolding that bypasses folding and use it in some cases.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 14, 2022
@ghost ghost assigned jakobbotsch Aug 14, 2022
@ghost
Copy link

ghost commented Aug 14, 2022

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

Issue Details

For a lot of extremely common binary VN functions we do a series of
unnecessary folding checks, in particular VNF_ValWithExc and
VNF_ExcSetCons. Introduce a VNForFuncNoFolding and
VNPairForFuncNoFolding that bypasses folding and use it in some cases.

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch added this to the 8.0.0 milestone Aug 15, 2022
@jakobbotsch
Copy link
Member Author

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Looks good.

Wondering if the assert I suggested might help catch future cases where somebody bypasses folding when it would help.

GetVNFunc2Map()->Set(fstruct, resultVN);
}
return resultVN;
}
Copy link
Member

Choose a reason for hiding this comment

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

How costly/difficult would it be to assert that we get the same result here as if we'd tried folding?

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 suppose in the debug build we can just call the regular version from the *NoFolding variant and validate that no folding occurred.

Copy link
Member Author

@jakobbotsch jakobbotsch Sep 5, 2022

Choose a reason for hiding this comment

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

I did this but I'm not too happy with it since it bypasses the "normal" implementation of VNForFuncNoFolding in debug builds which seems scary. And since VNForFunc has side effects related to using the cache I'm not a big fan of using that in an assert either. I'll leave this as-is, in the worst case it is just going to be some missed opportunities anyway.

@jakobbotsch jakobbotsch reopened this Aug 31, 2022
@jakobbotsch jakobbotsch merged commit 33704a5 into dotnet:main Sep 8, 2022
@jakobbotsch jakobbotsch deleted the opt-vn-for-func branch September 8, 2022 15:28
@ghost ghost locked as resolved and limited conversation to collaborators Oct 8, 2022
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