Similar for sub, or, and xor. All ops 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.
| Paths 
 |  Differential  D140465  
[RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X, 0), Y). ClosedPublic Authored by craig.topper on Dec 21 2022, 12:56 AM. 
Details Summary Similar for sub, or, and xor. All ops that have 0 as a neutral value. This allows us to remove some XVentanaCondOps patterns and 
Diff Detail 
 Event TimelineComment Actions Modulo minor feedback on a code comment (same applies for the patch title), this LGTM. 
 This revision is now accepted and ready to land.Dec 21 2022, 1:50 AM This revision was landed with ongoing or failed builds.Dec 21 2022, 10:58 AM Closed by commit rG132546d9397c: [RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X… (authored by craig.topper).  ·  Explain Why This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
 
Diff 484623 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
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This comment doesn't match the body of the function, as it handles sub/add/or/xor