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 majority of failures in libraries-jitstressregs after EHWriteThru enabled #48829

Merged
merged 3 commits into from
Mar 3, 2021

Conversation

kunalspathak
Copy link
Member

@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 Feb 26, 2021
@kunalspathak
Copy link
Member Author

@dotnet/jit-contrib

@@ -10773,7 +10773,7 @@ void LinearScan::verifyFinalAllocation()
{
// Free Registers.
// We could use the freeRegisters() method, but we'd have to carefully manage the active intervals.
for (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT(reg))
for (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT && regsToFree != RBM_NONE; reg = REG_NEXT(reg))
Copy link
Member

Choose a reason for hiding this comment

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

This new clause is a loop invariant, so maybe hoist it out...?

Suggested change
for (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT && regsToFree != RBM_NONE; reg = REG_NEXT(reg))
if (regsToFree != RBM_NONE)
{
for (regNumber reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT(reg))

Or perhaps better yet (but maybe more involved) only iterate over the set bits of regsToFree using find first bit or similar tech (presumably regsToFree is mostly zeros so iterating over each bit is a little wasteful).

Also a few lines below the code seems odd, we should make sure we know which of the assignments is the right one.

            regsToFree = delayRegsToFree;
            regsToFree = RBM_NONE;

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for pointing it out about the regsToFree = delayRegsToFree; , I should have noticed it. But I did notice other problem where delayRegsToFree in this method is never assigned and is always RBM_NONE so the odd code doesn't do any harm. Probably, some day, I should check right way to introduce delayRegsToFree, but for now, I will fix the odd code as well as get rid of delayRegsToFree variable from this method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, regsToFree is never used and it was that way from initial commit (6 years back). So as a cleanup, I will also get rid of regsFree and investigate what is the right way as part of #48837.

These two variables were always set to `RBM_NONE`. As part of dotnet#48837, investigate how to reintroduce them.
Base automatically changed from master to main March 1, 2021 09:08
@kunalspathak
Copy link
Member Author

@AndyAyersMS or @BruceForstall - can you please review this?

@AndyAyersMS
Copy link
Member

Were you planning to make changes based on my earlier comments, or leave that for a subsequent PR?

@kunalspathak
Copy link
Member Author

Were you planning to make changes based on my earlier comments, or leave that for a subsequent PR?

Ah, sorry, I didn't push it. Let me do it.

@kunalspathak kunalspathak merged commit b51270d into dotnet:main Mar 3, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2021
@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Apr 15, 2021
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