[RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X, 0...
authorCraig Topper <craig.topper@sifive.com>
Wed, 21 Dec 2022 18:39:41 +0000 (10:39 -0800)
committerCraig Topper <craig.topper@sifive.com>
Wed, 21 Dec 2022 18:57:57 +0000 (10:57 -0800)
commit132546d9397c062d4b2f50fac76392a11d3d6f27
tree6e0b4977ea9eef9be41f1be47260db6c1032e588
parent475cc44a2cba45c5449a323c6b331ddc593bd8de
[RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X, 0), Y).

Similar for sub, or, and xor. These are all operations that have 0
as a neutral value. This is based on a similar tranform in InstCombine.

This allows us to remove some XVentanaCondOps patterns and
some code from DAGCombine for RISCVISD::SELECT_CC.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D140465
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoXVentana.td
llvm/test/CodeGen/RISCV/select.ll
llvm/test/CodeGen/RISCV/sextw-removal.ll