[PATCH] D133739: [RISCV][WIP] Form more VW instructions

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 00:32:28 PDT 2022


craig.topper added a comment.

In D133739#3788725 <https://reviews.llvm.org/D133739#3788725>, @dcaballe wrote:

> Thanks for moving this forward, @qcolombet!
>
> I wonder if even for cases where not all the users of the extension are folded, the performance gain from using a `vw` variant would make up for keeping two extension instructions. Any idea?

One issue is that f it's a 4x or 8x extend, we only fold part of it. If we don't fold all uses, we'll have a 4x/8x extend left behind and a new 2x/4x extend created by the fold.

Other thoughts I had were about register pressure at larger LMULs. Not folding all uses of the extend increases the live range of the input to the extend.

On the other hand, it starts getting expensive to fully check that all uses can fold. If there are N users, we'll run the checks something like (N*(N+1))/2 times.



================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:8588
+bool canFoldExtensionInAllUsers(SDValue Val) {
+  return std::all_of(Val->use_begin(), Val->use_end(),
+                     canFoldExtensionInOpcode);
----------------
Can this be something like `llvm::all_of(Val->uses()`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133739



More information about the llvm-commits mailing list