[PATCH] D153948: [RISCV][NFC] Refactor lowerToScalableOp.

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 19:24:27 PDT 2023


jacquesguan added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:4625
+bool RISCVTargetLowering::hasMergeOp(unsigned Opcode) const {
+  assert(Opcode > RISCVISD::FIRST_NUMBER &&
+         Opcode <= RISCVISD::STRICT_VFROUND_NOEXCEPT_VL && "not a valid op");
----------------
frasercrmck wrote:
> jacquesguan wrote:
> > frasercrmck wrote:
> > > I wonder if we want stronger checks here so people don't insert an op in the wrong place and have weird stuff happen.
> > change to `report_fatal_error`?
> I was thinking more along the lines of `static_asserts` that check that nodes are defined roughly as we expect, or that there are as many nodes in between the ranges as we expect. That way someone can't insert any op in between `RISCVISD::VWMUL_VL` and `RISCVISD::VFWSUB_W_VL` (for example) without seeing a compile-time error and having to think about whether it has a merge op and whether the code needs updating.
I get your idea, thanks. I add an assert to check the number of riscv target specific isd, make sure any change should update these 2 function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153948



More information about the llvm-commits mailing list