[PATCH] D135403: [RISCV] Verify that policy operands only exist on instructions with tied passthru operands

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 14:16:26 PDT 2022


reames created this revision.
reames added a reviewer: craig.topper.
Herald added subscribers: sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, 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.

This is a non-trivial property relied upon by D135396 <https://reviews.llvm.org/D135396>.  I wrote this to convince myself it was true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135403

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


Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1266,6 +1266,15 @@
       ErrInfo = "policy operand w/o VL operand?";
       return false;
     }
+
+    // VecPolicy operands can only exist on instructions with passthru/merge
+    // arguments. Note that not all arguments with passthru have vec policy
+    // operands- some instructions have implicit policies.
+    unsigned UseOpIdx;
+    if (!MI.isRegTiedToUseOperand(0, &UseOpIdx)) {
+      ErrInfo = "policy operand w/o tied operand?";
+      return false;
+    }
   }
 
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135403.465874.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221006/cf566bbb/attachment.bin>


More information about the llvm-commits mailing list