Skip to content

Commit

Permalink
Remove GTF_NO_CSE on the first FIELD_LIST arg (dotnet#57411)
Browse files Browse the repository at this point in the history
The code constructing the list reuses the original
local node for the first field. Such a node is likely
to have come from an OBJ(ADDR(LCL_VAR)) tree, thus
having GTF_NO_CSE set on it, pessimizing handling of
the promoted struct field, in particular, blocking
global constant propagation.

Fix this by calling SetOperResetFlags instead of
ChangeOper. This may lose some flags, but the other
fields in the list did not have them set in any case.
  • Loading branch information
SingleAccretion authored Sep 13, 2021
1 parent 19c5f54 commit 5ccb57a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4223,7 +4223,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
if (fieldLclNum == varDsc->lvFieldLclStart)
{
lcl->SetLclNum(fieldLclNum);
lcl->ChangeOper(GT_LCL_VAR);
lcl->SetOperResetFlags(GT_LCL_VAR);
lcl->gtType = fieldVarDsc->TypeGet();
fieldLcl = lcl;
}
Expand Down

0 comments on commit 5ccb57a

Please sign in to comment.