Skip to content

JIT ARM32: LSRA does not kill R2R indirection cell reg on calls using it #70552

Description

@jakobbotsch

On ARM32 VSD calls and R2R calls pass an indirection cell in R4 which is a callee-saved register. This is unlike other platforms where a volatile register is used instead. Because of this there has to be special handling in getKillSetForCall, but currently we only have such handling for VSD calls:

#ifdef TARGET_ARM
if (call->IsVirtualStub())
{
killMask |= compiler->virtualStubParamInfo->GetRegMask();
}
#else // !TARGET_ARM

We work around this issue in morph by locking in the register requirement on the node itself and marking the constant as no-CSE:

indirectCellAddress->SetRegNum(REG_R2R_INDIRECT_PARAM);
#ifdef TARGET_ARM
// Issue #xxxx : Don't attempt to CSE this constant on ARM32
//
// This constant has specific register requirements, and LSRA doesn't currently correctly
// handle them when the value is in a CSE'd local.
indirectCellAddress->SetDoNotCSE();
#endif // TARGET_ARM

When I have tried fixing the problem and removing the morph workaround I have seen som large-ish crossgen ARM regressions, so some more investigation is needed.

category:correctness
theme:register-allocator

Activity

  1. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Jun 10, 2022
  2. added this to the 8.0.0 milestone on Jun 10, 2022
  3. jakobbotsch commented on Jun 10, 2022

    @jakobbotsch
    MemberAuthor
  4. jakobbotsch commented on Jun 10, 2022

    @jakobbotsch
    MemberAuthor

    I was originally fixing this as part of #70491, but the diffs on ARM looked like:

    libraries.crossgen2.Linux.arm.checked.mch:
    
    Summary of Code Size diffs:
    (Lower is better)
    
    Total bytes of base: 33123356 (overridden on cmd)
    Total bytes of diff: 33176880 (overridden on cmd)
    Total bytes of delta: 53524 (0.16 % of base)
        diff is a regression.
        relative diff is a regression.

    I reverted the fix in 6ef03b4.

  5. self-assigned this
    on Jun 13, 2022
  6. modified the milestones: 8.0.0, Future on Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-arm32area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions