[RISCV] Remove one use restriction on the scalar from combineBinOpToReduce.
authorCraig Topper <craig.topper@sifive.com>
Wed, 26 Apr 2023 04:10:58 +0000 (21:10 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 26 Apr 2023 04:10:58 +0000 (21:10 -0700)
commit12cd7e11aad01ba0ff35d76707ba956b2fb14e8b
tree424462dee3847d5f23cfc2779f94975b58ebeaf7
parent68e1aef68e40452b6c176b25e67c13a0359c96ca
[RISCV] Remove one use restriction on the scalar from combineBinOpToReduce.

If multiple reductions use the neutral start value, this prevented
us from optimizing any of them.

This increases the number of scalar->vector operations but reduces
the number of scalar operations.

Note, we were already inconsistent about the one use check when we
peeked through INSERT_SUBVECTORs.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D149181
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fold-binary-reduce.ll