-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 stores as operands of calls in LIR #68460
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -615,6 +615,28 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, Compiler::Ge | |
RewriteIndir(use); | ||
break; | ||
|
||
case GT_CALL: | ||
// In linear order we no longer need to retain the stores in early | ||
// args as these have now been sequenced. | ||
for (CallArg& arg : node->AsCall()->gtArgs.EarlyArgs()) | ||
{ | ||
if (!arg.GetEarlyNode()->IsValue()) | ||
{ | ||
// GTF_LATE_ARG is no longer meaningful. | ||
arg.GetEarlyNode()->gtFlags &= ~GTF_LATE_ARG; | ||
arg.SetEarlyNode(nullptr); | ||
Comment on lines
+626
to
+627
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Currently it will work ok because liveness will count the Would be curious to know your thinking on this; my idea was to forbid forcing the buffer arguments to temps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised it would ever be evaluated to a temp since it should be invariant. But yes, we should avoid creating a temp for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree, it is mostly a "model" concern, without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opened #68469 to stop it looking into the stores and to assert the contract more heavily. |
||
} | ||
} | ||
|
||
#ifdef DEBUG | ||
// The above means that all argument nodes are now true arguments. | ||
for (CallArg& arg : node->AsCall()->gtArgs.Args()) | ||
{ | ||
assert((arg.GetEarlyNode() == nullptr) != (arg.GetLateNode() == nullptr)); | ||
} | ||
#endif | ||
break; | ||
|
||
case GT_NOP: | ||
// fgMorph sometimes inserts NOP nodes between defs and uses | ||
// supposedly 'to prevent constant folding'. In this case, remove the | ||
|
@@ -637,8 +659,8 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, Compiler::Ge | |
if ((sideEffects & GTF_ALL_EFFECT) == 0) | ||
{ | ||
// The LHS has no side effects. Remove it. | ||
// None of the transforms performed herein violate tree order, so isClosed | ||
// should always be true. | ||
// All transformations on pure trees keep their operands in LIR | ||
// and should not violate tree order. | ||
assert(isClosed); | ||
|
||
BlockRange().Delete(comp, m_block, std::move(lhsRange)); | ||
|
@@ -666,8 +688,8 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, Compiler::Ge | |
|
||
if ((sideEffects & GTF_ALL_EFFECT) == 0) | ||
{ | ||
// None of the transforms performed herein violate tree order, so isClosed | ||
// should always be true. | ||
// All transformations on pure trees keep their operands in | ||
// LIR and should not violate tree order. | ||
assert(isClosed); | ||
|
||
BlockRange().Delete(comp, m_block, std::move(rhsRange)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a cursory glance this use of
GTF_LATE_ARG
is (was) the only blocker of its removal.