[PATCH] D155101: [RISCV] Fold ops into vmv.v.v as vmerge with all-ones mask

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 12:59:34 PDT 2023


reames requested changes to this revision.
reames added a comment.
This revision now requires changes to proceed.

Generally much better than the alternative, but needs a bit of restructuring.



================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:3241
+                                       AllOnesMask, SDValue());
+  SDValue Mask = DAG->getRegister(RISCV::V0, MaskVT);
+
----------------
Creating a new vmset here is bad if the caller ends up returning.

You can leave the Merge as an uninitialized SDValue, and lazily create the alls ones mask on demand if needed.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:3265
+  // mask.
+  if (!getVMergeOpsFromVMv(N, CurDAG, VMergeOps))
+    VMergeOps = SmallVector<SDValue>(N->ops());
----------------
This structure is really hard to read.

If you handle the vmerge case inside the helper, you can just unconditionally return the ops array.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155101



More information about the llvm-commits mailing list