[PATCH] D151653: [WIP][RISCV] Combine vmv.s.x of constants into vmv.v.i

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 03:44:41 PDT 2023


luke added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:12352
+        SDValue VL = N->getOperand(2);
+        // If VL is a constant > 0, then change it to 1 to increase
+        // the chances of a toggle being removed by the insert vsetvli
----------------
reames wrote:
> This looks like something we should maybe be doing for all vmv.s.x instructions.  What happens if you hoist this out of the vmv.v.i specific transform?
The VLs do get smaller but there's the same amount of toggles. I think the insertvsetvli pass already allows the VL to be increased or decreased on a vmv.s.x pseudo to avoid a toggle (as long as it maintains that it is or isn't equal to zero), whilst here it was specifically to accommodate the fact that this gets selected as a vmv.v.i pseudo

I'm not 100% sure if it's worthwhile but I've attached the diff anyway

{F27774463}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151653



More information about the llvm-commits mailing list