[all-commits] [llvm/llvm-project] e88432: [RISCV] Generalize select (and (x , 0x1) == 0), y, ...

Philip Reames via All-commits all-commits at lists.llvm.org
Mon Oct 3 13:57:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e88432414517c8f2e6efa9f02828053e6e25bc6a
      https://github.com/llvm/llvm-project/commit/e88432414517c8f2e6efa9f02828053e6e25bc6a
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-10-03 (Mon, 03 Oct 2022)

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

  Log Message:
  -----------
  [RISCV] Generalize select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) ) transforms by removing and-clause

These transforms were recently added (by me) in D134881. Looking at the code again, I realized we don't need the (and x, 0x1) portion of the pattern, we just need to know that the result of that sub-tree is either 0 or 1. Checking for this directly allows us to match slightly more broadly. The test changes are zext i1 arguments, but this could also kick in for e.g. shifts of high bits, or any other source of known bits.

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




More information about the All-commits mailing list