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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 11:52:15 PDT 2022


reames created this revision.
reames added reviewers: craig.topper, kito-cheng, frasercrmck.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

In D127983 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128085

Files:
  llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp


Index: llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -406,6 +406,8 @@
   // 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;
@@ -889,6 +891,9 @@
   } else {
     InstrInfo.setAVLReg(RISCV::NoRegister);
   }
+  if (Optional<unsigned> EEW = getEEWForLoadStore(MI)) {
+    assert(SEW == EEW && "Initial SEW doesn't match expected EEW");
+  }
   InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic);
 
   return InstrInfo;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128085.437995.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220617/1f44d2c4/attachment.bin>


More information about the llvm-commits mailing list