[RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.
authorCraig Topper <craig.topper@sifive.com>
Wed, 26 Apr 2023 01:46:54 +0000 (18:46 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 26 Apr 2023 01:46:54 +0000 (18:46 -0700)
commite80da0f8409aaf70d18b12c5d5d884f2c9cbddcc
tree8b8bc9554e12abc12a209816504998ef8703e292
parent12d8e175118901c83c1d97a990c9f13d4ae1212c
[RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.

If the reduction AVL is 0, operand 0 of the reduction will be
returned rather than the scalar input.

To make the fold legal, we would need to fold the new scalar value
with whatever operand 0 is which may require a new scalar operation
before the reduction.

Block the combine if we can't prove AVL is non-zero.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D149174
llvm/lib/Target/RISCV/RISCVISelLowering.cpp