[all-commits] [llvm/llvm-project] d01895: [RISCV] Fold binary op into select if profitable.

mgudim via All-commits all-commits at lists.llvm.org
Mon Jun 12 11:19:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0189584631e587279ee5f0af5feb94d8045bb31
      https://github.com/llvm/llvm-project/commit/d0189584631e587279ee5f0af5feb94d8045bb31
  Author: Mikhail Gudim <mgudim at gmail.com>
  Date:   2023-06-12 (Mon, 12 Jun 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    A llvm/test/CodeGen/RISCV/fold-binop-into-select.ll

  Log Message:
  -----------
  [RISCV] Fold binary op into select if profitable.

Consider the following pattern `binOp (select cond, x, c0), c1`.
Where `c0` and `c1` are constants.
We can transform it to `select cond, binOp(x, c1), binOp(c0, c1)`.

If `binOp(c0, c1)` ends up being `0` or `-1` we can turn the select into
a more profitable sequence.




More information about the All-commits mailing list