Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Don't force byte regs for indir address #16727

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

CarolEidt
Copy link

No description provided.

@CarolEidt
Copy link
Author

This came up in the process of eliminating TreeNodeInfo (#16517). Indirections that load a byte value don't need a byte register for the address.
This change results in a net reduction of 4520 bytes (-0.01%) in jit-diffs (frameworks & tests). There are a small number of regressions due to different register allocation.

@CarolEidt
Copy link
Author

@dotnet/jit-contrib PTAL

@@ -754,7 +754,9 @@ void LinearScan::BuildCheckByteable(GenTree* tree)
if (tree->OperIsSimple())
{
GenTree* op = tree->gtOp.gtOp1;
if (op != nullptr)
// We need byte registers on the operands of most simple operators that produce a byte result.
// However, indirections are simple operators but do not require their address in a byte register.

Choose a reason for hiding this comment

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

In which cases does indirection produce byte results?

Copy link
Author

Choose a reason for hiding this comment

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

If the indirection is loading a byte from memory (e.g. a field of a struct), it will be of type byte. The register it loads into must be a byte register, but the address need not be.

Copy link

Choose a reason for hiding this comment

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

Hmm, usually an indirection of type byte/ubyte will generate a movsx/movzx instruction. In that case you don't need a byte register, the destination register is really a 32 bit register.

Copy link

@sandreenko sandreenko left a comment

Choose a reason for hiding this comment

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

LGTM

@CarolEidt CarolEidt merged commit aea9340 into dotnet:master Mar 5, 2018
@CarolEidt CarolEidt deleted the NoIndirByte branch March 5, 2018 21:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants