Skip to content

[RISCV] Post-PEI MIR testing is broken with Zcmp/libcalls #79491

@francisvm

Description

@francisvm

MIR printing is broken when trying to serialize the output after PrologEpilogInserter (-run-pass=prologepilog or -stop-after).

llc -mtriple=riscv32 -mattr=+zcmp -x mir -run-pass=prologepilog -verify-machineinstrs -o - zcmp-cm-push-pop.mir:

Assertion failed: (unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"), function isDeadObjectIndex, file MachineFrameInfo.h, line 747.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.

Zcmp/save-restore-libcalls have pre-defined frame indices for the saved registers but they're never allocated in MachineFrameInfo. When MIRPrinting occurs, the index found in the entries in MachineFrameInfo::CalleeSavedInfos is not to be found in MachineFrameInfo::Objects, and isDeadObjectIndex asserts.

We should create proper (fixed?) slots in MFI in the future to avoid inconsistencies there, since we don't really care about the frame index to be fixed, but the location on the stack.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions