[RISCV] Assert initial load/store SEW is the EEW

In D127983, I had flipped from using the computed EEW to using the SEW value pulled from the VSETVLI when checking compatibility. This wasn't intentional, though thankfully it appears to be a non-functional difference. The new code does make a unchecked assumption that the initial SEW operand on the load/store is the EEW. This patch clarifies the assumption, and adds an assert to make sure this remains true.

Differential Revision: https://reviews.llvm.org/D128085
This commit is contained in:
Philip Reames 2022-06-20 07:41:18 -07:00 committed by Philip Reames
parent 1c92e06ded
commit 820e84e050
1 changed files with 7 additions and 0 deletions

View File

@ -408,6 +408,8 @@ static DemandedFields getDemanded(const MachineInstr &MI) {
// They instead demand the ratio of the two which is used in computing
// EMUL, but which allows us the flexibility to change SEW and LMUL
// provided we don't change the ratio.
// Note: We assume that the instructions initial SEW is the EEW encoded
// in the opcode. This is asserted when constructing the VSETVLIInfo.
if (getEEWForLoadStore(MI)) {
Res.SEW = false;
Res.LMUL = false;
@ -885,6 +887,11 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
} else {
InstrInfo.setAVLReg(RISCV::NoRegister);
}
#ifndef NDEBUG
if (Optional<unsigned> EEW = getEEWForLoadStore(MI)) {
assert(SEW == EEW && "Initial SEW doesn't match expected EEW");
}
#endif
InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic);
return InstrInfo;