[PATCH] D109394: [RISCV] Enable CGP to sink splat operands of Add/Sub/Mul.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 08:47:07 PDT 2021


frasercrmck added a comment.

Thanks for this patch! I've seen this problem locally but I hadn't found the time to investigate this; I didn't know there was already a handy utility to help sink these splats.

The code and principle definitely LGTM/SGTM, just I had questions about how else we may be able to go about it.



================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1049
+
+      ShuffleVectorInst *Shuffle = dyn_cast<ShuffleVectorInst>(Op);
+      if (!Shuffle || !Shuffle->isZeroEltSplat())
----------------
Do you think the IR pattern matching library would be appropriate to use here?

While I'm on that subject, do you think it's worth separating this logic out into a new pattern matcher (e.g. `m_VectorSplat`) if there isn't one already?


================
Comment at: llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=riscv64 -mattr=+m,+experimental-v \
----------------
Might be worth pre-committing these tests just to help this patch shine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109394



More information about the llvm-commits mailing list