Skip to content

Commit 738c3ed

Browse files
committed
[RISCV] Pre-commit test for FrameIndex handling in getMemOperandsWithOffsetWidth
Currently AArch64 handles a FrameIndex operand in this function, but we fail to.
1 parent 9b19259 commit 738c3ed

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,19 @@ TEST_P(RISCVInstrInfoTest, GetMemOperandsWithOffsetWidth) {
153153
.addImm(16);
154154
Res = TII->getMemOperandsWithOffsetWidth(*MI, BaseOps, Offset,
155155
OffsetIsScalable, Width, TRI);
156+
157+
// TODO: AArch64 can handle this case, and we probably should too.
158+
BaseOps.clear();
159+
MMO = MF->getMachineMemOperand(MachinePointerInfo(),
160+
MachineMemOperand::MOStore, 4, Align(4));
161+
MI = BuildMI(*MF, DL, TII->get(RISCV::SW))
162+
.addReg(RISCV::X3)
163+
.addFrameIndex(2)
164+
.addImm(4)
165+
.addMemOperand(MMO);
166+
Res = TII->getMemOperandsWithOffsetWidth(*MI, BaseOps, Offset,
167+
OffsetIsScalable, Width, TRI);
168+
EXPECT_FALSE(Res);
156169
}
157170

158171
} // namespace

0 commit comments

Comments
 (0)