-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Question] impCloneExpr
vs fgInsertCommaFormTemp
+ gtCloneExpr
#35314
Comments
CC. @CarolEidt since I saw these differences when going through |
I suspect that these should be unified, though it wouldn't surprise me that some of the differences were due to some varying requirements based on what phase it's in. |
At least in the case of |
in my PR I used auto cloned = gtCloneExpr(op1->OperIsLeaf() ? op1 : fgMakeMultiUse(&tree->AsOp()->gtOp1)); (not sure |
|
Given that we haven't had any bugs (that I know of) from the variety of approaches to handling duplicated operands, I'm tempted to say we should put off any cleanup work until after 5.0. We can try to clean up/unify early in 6.0. Thoughts? |
That sounds reasonable to me. I was mostly just interested as I had seen a number of varying mechanisms 😄 |
Ok, I'm going to move this. |
Looking at various parts of the importer, it looks like one of a couple approaches are used when a node needs to be copied. All of these code paths are functionally similar but with minor tweaks in the actual checks done and when a given node is copied to a local vs cloned. I was wondering if there is a "correct" one that should be getting used and if the various paths should be normalized to a single helper method?
The first is just calling
impCloneExpr
which callsgtClone
if the tree isn'tGTF_GLOB_EFFECT
and is simple and which creates a newLCL_VAR
node otherwise: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/jit/importer.cpp#L2643However, there are other areas that don't use this method and instead check for
GTF_SIDE_EFFECT
callingfgInsertCommaFormTemp
and callinggtCloneExpr
otherwise: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/jit/simd.cpp#L1390-L1397There are also some places that directly create an additional
LCL_VAR
node if it needs two copies of the data: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/jit/simd.cpp#L1319There are also various places that just directly clone or insert a temp without the above associated checks.
category:question
theme:importer
skill-level:intermediate
cost:medium
The text was updated successfully, but these errors were encountered: