[PATCH] D107603: [RISCV] Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add x, y))

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 17:07:05 PDT 2021


craig.topper added a comment.

In D107603#2930673 <https://reviews.llvm.org/D107603#2930673>, @frasercrmck wrote:

> A general observation is that expanding this to `ISD::SELECT` now opens this up to vector types. I think the only thing that's now preventing it is `isZeroOrAllOnes` which "silently" (for want of a better word) only accepts scalar constants.
>
> My first thoughts are that we could either be clearer about not accepting vector types, or - without wanting to expand the scope of this patch - we do open it up to vectors. From a quick play around on top of your patch it doesn't look too useful in that case, though. A vector `add_select_all_zeros_v4i32` just introduces an extra `vsetvli`.

I disabled it for vectors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107603



More information about the llvm-commits mailing list