[RISCV] Replace untested code with assert
We found untested code where negative frame indices were ostensibly handled despite it being in a block guarded by !MFI.isFixedObjectIndex. While the implementation of MachineFrameInfo::isFixedObjectIndex suggests this is possible (i.e., if a frame index was more negative - less than the number of fixed objects), I couldn't find any test in tree -- for any target -- where a negative frame index wasn't also a fixed object offset. I couldn't find a way of creating such a object with the public MachineFrameInfo creation APIs. Even MachineFrameInfo::getObjectIndexBegin starts counting at the negative number of fixed objects, so such frame indices wouldn't be covered by loops using the provided begin/end methods. Given all this, an assert that any object encountered in the block is non-negative seems reasonable. Reviewed By: StephenFan, kito-cheng Differential Revision: https://reviews.llvm.org/D126278
This commit is contained in:
parent
e59f648d69
commit
fd93736657
|
@ -757,8 +757,7 @@ RISCVFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
|
|||
// objects to the required alignment.
|
||||
if (MFI.getStackID(FI) == TargetStackID::Default) {
|
||||
Offset += StackOffset::getFixed(MFI.getStackSize());
|
||||
if (FI < 0)
|
||||
Offset += StackOffset::getFixed(RVFI->getLibCallStackSize());
|
||||
assert(FI >= 0 && "Unhandled negative frame index");
|
||||
} else if (MFI.getStackID(FI) == TargetStackID::ScalableVector) {
|
||||
// Ensure the base of the RVV stack is correctly aligned: add on the
|
||||
// alignment padding.
|
||||
|
|
Loading…
Reference in New Issue