[all-commits] [llvm/llvm-project] c5c2de: [RISCV][ISel] Fold extensions when all the users c...

qcolombet via All-commits all-commits at lists.llvm.org
Wed Oct 5 13:50:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c5c2de287e5ff1803a10d94b0ab17b579442726d
      https://github.com/llvm/llvm-project/commit/c5c2de287e5ff1803a10d94b0ab17b579442726d
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

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

  Log Message:
  -----------
  [RISCV][ISel] Fold extensions when all the users can consume them

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.

Differential Revision: https://reviews.llvm.org/D133739




More information about the All-commits mailing list