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

[llvm][RISCV] Set ScalableVector stack id in proper place #117862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 27, 2024

  1. [llvm] Set ScalableVector stack id in proper place

    Without this patch ScalableVector frame index property is used before assignment.
    More precisely, let's take a look at RISCVFrameLowering::assignCalleeSavedSpillSlots.
    In this function we divide callee saved registers on scalar and vector ones,
    based on ScalableVector property of their frame indexes:
    ```
      ...
      const auto &UnmanagedCSI = getUnmanagedCSI(*MF, CSI);
      const auto &RVVCSI = getRVVCalleeSavedInfo(*MF, CSI);
      ...
    ```
    But we assign ScalableVector property several lines below:
    ```
      ...
      auto storeRegToStackSlot = [&](decltype(UnmanagedCSI) CSInfo) {
        for (auto &CS : CSInfo) {
          // Insert the spill to the stack frame.
          Register Reg = CS.getReg();
          const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg);
          TII.storeRegToStackSlot(MBB, MI, Reg, !MBB.isLiveIn(Reg),
                                  CS.getFrameIdx(), RC, TRI, Register());
        }
      };
      storeRegToStackSlot(UnmanagedCSI);
      ...
    ```
    Due to it, list of RVV callee saved registers will always be empty.
    Currently this problem doesn't appear, but if you slightly change the code and,
    for example, put some instructions between scalar and vector spills,
    the resulting code will be ill formed.
    enoskova-sc committed Nov 27, 2024
    Configuration menu
    Copy the full SHA
    7931bae View commit details
    Browse the repository at this point in the history