[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:56:20 PDT 2022


reames updated this revision to Diff 437999.
reames added a comment.

Wrap code in macro to avoid release build warning.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128085/new/

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,11 @@
   } 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;


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


More information about the llvm-commits mailing list