[PATCH] D133739: [RISCV][ISel] Fold extensions when all the users can consume them

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 22:05:14 PDT 2022


qcolombet updated this revision to Diff 463095.
qcolombet retitled this revision from "[RISCV][WIP] Form more VW instructions" to "[RISCV][ISel] Fold extensions when all the users can consume them".
qcolombet added a comment.

This patch allows the combines that fold extensions in binary operations to have more than one use.
The approach here is pretty conservative: if all the users of an extension can fold the extension, then the folding is done, otherwise we don't fold. This is the first step towards avoiding the one-use limitation.

As a result, we make a decision to fold/don't fold for a web of instructions. An instruction is part of the web of instructions as soon as it consumes an extension that needs to be folded for all its users.

Because of how SDISel works a web of instructions can be visited over and over. More precisely, if the folding happens, it happens for the whole web and that's the end of it, but if the folding fails, the whole web may be revisited when another member of the web is visited.

To avoid a compile time explosion in pathological cases, we bail out earlier for webs that are bigger than a given threshold (arbitrarily set at 18 for now.) This size can be changed using `--riscv-lower-ext-max-web-size=<maxWebSize>`.

At the current time, I didn't see a better scheme for that. Assuming we want to stick with doing that in SDISel.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133739

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vw-web-simplification.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vwmul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133739.463095.patch
Type: text/x-patch
Size: 9238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220927/bed3abdf/attachment.bin>


More information about the llvm-commits mailing list