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 stores as operands of calls in LIR #68460

Merged
merged 4 commits into from
Apr 27, 2022

Conversation

jakobbotsch
Copy link
Member

These are part of operands in HIR simply for ordering purposes, which is
no longer necessary in LIR. This means that every argument operand in
LIR now has exactly one node, which between rationalization and lowering
is always a value.

We still have cases of operands that are non-values, in particular the
operand of GT_JTRUE nodes and also GT_PUTARG_STK nodes after lowering.
However, at least for calls the LIR invariant is now simpler: before
lowering all argument operands are values, and after all argument
operands are GT_PUTARG_* nodes.

Not having stores as operands will also allow us to get rid of
GTF_LATE_ARG in a follow-up change.

cc @dotnet/jit-contrib

These are part of operands in HIR simply for ordering purposes, which is
no longer necessary in LIR. This means that every argument operand in
LIR now has exactly one node, which between rationalization and lowering
is always a value.

We still have cases of operands that are non-values, in particular the
operand of GT_JTRUE nodes and also GT_PUTARG_STK nodes after lowering.
However, at least for calls the LIR invariant is now simpler: before
lowering all argument operands are values, and after all argument
operands are GT_PUTARG_* nodes.

Not having stores as operands will also allow us to get rid of
GTF_LATE_ARG in a follow-up change.
@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 Apr 24, 2022
@ghost ghost assigned jakobbotsch Apr 24, 2022
@ghost
Copy link

ghost commented Apr 24, 2022

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

Issue Details

These are part of operands in HIR simply for ordering purposes, which is
no longer necessary in LIR. This means that every argument operand in
LIR now has exactly one node, which between rationalization and lowering
is always a value.

We still have cases of operands that are non-values, in particular the
operand of GT_JTRUE nodes and also GT_PUTARG_STK nodes after lowering.
However, at least for calls the LIR invariant is now simpler: before
lowering all argument operands are values, and after all argument
operands are GT_PUTARG_* nodes.

Not having stores as operands will also allow us to get rid of
GTF_LATE_ARG in a follow-up change.

cc @dotnet/jit-contrib

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

//
void Compiler::fgRemoveDeadStoreLIR(GenTree* store, BasicBlock* block)
{
LIR::Range& blockRange = LIR::AsRange(block);

// If the store is marked as a late argument, it is referenced by a call.
// Instead of removing it, bash it to a NOP.
if ((store->gtFlags & GTF_LATE_ARG) != 0)
Copy link
Member Author

@jakobbotsch jakobbotsch Apr 24, 2022

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.

Comment on lines +626 to +627
arg.GetEarlyNode()->gtFlags &= ~GTF_LATE_ARG;
arg.SetEarlyNode(nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

GTF_CALL_M_RETBUFFARG_LCLOPT has a dependency on being able to reach the setup node from the call.

Currently it will work ok because liveness will count the LCL_VAR|FLD_ADDR as the definition point, but that itself is only fine because GTF_CALL_M_RETBUFFARG_LCLOPT is tied to lvIsTemp.

Would be curious to know your thinking on this; my idea was to forbid forcing the buffer arguments to temps.

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'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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Agree, it is mostly a "model" concern, without GTF_CALL_M_RETBUFFARG_LCLOPT forcing things to temps is always legal, with it (+ this change), it isn't.

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 opened #68469 to stop it looking into the stores and to assert the contract more heavily.

@jakobbotsch
Copy link
Member Author

jakobbotsch commented Apr 25, 2022

This is currently waiting for #68469.

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr outerloop, runtime-coreclr jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch jakobbotsch merged commit 694067c into dotnet:main Apr 27, 2022
@jakobbotsch jakobbotsch deleted the lir-clean-up-call-operands branch April 27, 2022 19:38
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 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.

3 participants