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

Fix an over-constrained use of a byte reg #41004

Merged
merged 2 commits into from
Aug 21, 2020
Merged

Conversation

CarolEidt
Copy link
Contributor

Fix #40963

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 18, 2020
if (internalIsByte && (useCount >= 4))
{
noway_assert(internalIntDef != nullptr);
internalIntDef->registerAssignment = RBM_RAX;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual fix.

// we must have less than 4 sources.
// If we have 4 or more sources, and require a byteable internal register, we need to reserve
// one explicitly (see BuildBlockStore()).
assert(srcCount < 4);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and the other assert below are added because these are the only other semi-complex cases where we have byteable restrictions. I've convinced myself that we will never have more than 3 uses in these cases, so a simple assert is useful and sufficient (we don't need to check that we actually have a byteable register source).

@CarolEidt
Copy link
Contributor Author

@dotnet/jit-contrib PTAL
The remaining jitstressregs failures are #40607

Copy link
Contributor

@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

question: could we replace 4 with a constant defined in target.h? Can it be calculated from:

  #define RBM_BYTE_REGS           (RBM_EAX|RBM_ECX|RBM_EDX|RBM_EBX)
  #define RBM_NON_BYTE_REGS       (RBM_ESI|RBM_EDI)

?

Also, side question, could you please clarify for me why RBM_NON_BYTE_REGS does not include ESP, EBP? It has only one use but could it be wrong?

@CarolEidt
Copy link
Contributor Author

could you please clarify for me why RBM_NON_BYTE_REGS does not include ESP, EBP? It has only one use but could it be wrong

I believe it's because we don't use ESP in the register allocator, and perhaps because EBP is sometimes restricted. IMO we should probably just eliminate RBM_NON_BYTE_REGS but I don't think it's critical.

@CarolEidt CarolEidt merged commit a5b491c into dotnet:master Aug 21, 2020
@CarolEidt CarolEidt deleted the Fix40963 branch August 21, 2020 01:37
@CarolEidt
Copy link
Contributor Author

/backport to release/5.0

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2020

Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/233483644

@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
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.

Assertion failed 'farthestRefPhysRegRecord != nullptr'
3 participants