Skip to content

Conversation

@kunalspathak
Copy link
Contributor

No description provided.

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 30, 2024
@ghost ghost assigned kunalspathak Jan 30, 2024
@ghost
Copy link

ghost commented Jan 30, 2024

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

Issue Details

null

Author: kunalspathak
Assignees: kunalspathak
Labels:

area-CodeGen-coreclr

Milestone: -

Comment on lines 8858 to 8864
#if defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) || defined(TARGET_X86)
if (op1->IsLocal())
{
GenTreeLclVarCommon* lcl = op1->AsLclVarCommon();
terminatorNodeLclVarDsc = &compiler->lvaTable[lcl->GetLclNum()];
}
#endif
Copy link
Member

@jakobbotsch jakobbotsch Jan 30, 2024

Choose a reason for hiding this comment

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

Nit: can we merge it with below if to make it consistent with the BBJ_COND case? I.e.

if (op1->OperIs(GT_COPY))
{
  // code below
}
else if (op1->IsLocal())
{
  // new code
}

Also, I think op2 should get the handling too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, I think op2 should get the handling too

For GT_SWITCH, isn't the op2 always GT_JMPTABLE?

Copy link
Member

Choose a reason for hiding this comment

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

I think so. But I don't think anything guarantees LSRA doesn't add a GT_COPY on top of it, or something in the future doesn't introduce a local... I think just making it consistent with all the other cases doesn't hurt. In fact we could probably unify all handling here by writing the code something like:

if (block->HasTerminator())
{
  LIR::AsRange(block).LastNode()->VisitOperands([](GenTree* op) {
    if (op->OperIs(GT_COPY))
    {
        ...
    }
    else if (op->IsLocal())
    {
        ...
    }
    return VisitResult::Continue;
  });
}

which would also be a bit more future proof. But I'm also ok with just keeping the special casing for BBJ_COND/BBJ_SWITCH.

@ryujit-bot
Copy link

Diff results for #97713

Throughput diffs

Throughput diffs for windows/arm64 ran on windows/x64

MinOpts (-0.01% to +0.00%)
Collection PDIFF
libraries.pmi.windows.arm64.checked.mch -0.01%

Details here


@ryujit-bot
Copy link

Diff results for #97713

Throughput diffs

Throughput diffs for osx/arm64 ran on linux/x64

MinOpts (-0.01% to +0.00%)
Collection PDIFF
libraries.pmi.osx.arm64.checked.mch -0.01%

Throughput diffs for windows/arm64 ran on linux/x64

MinOpts (-0.00% to +0.01%)
Collection PDIFF
libraries.pmi.windows.arm64.checked.mch +0.01%

Details here


@kunalspathak kunalspathak marked this pull request as ready for review February 7, 2024 15:42
@kunalspathak kunalspathak merged commit bafd250 into dotnet:main Feb 7, 2024
@kunalspathak kunalspathak deleted the switch-resolution branch February 7, 2024 15:42
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2024
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