[llvm] [RISC-V][ISel] Remove redundant czero.eqz like 'czero.eqz a0, a0, a0' (PR #90208)

Zhijin Zeng via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 10:06:58 PDT 2024


================
@@ -7503,6 +7503,17 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
       return DAG.getNode(ISD::ADD, DL, VT, CMOV, RHSVal);
     }
 
+    // c = setcc f, 0, seteq
+    // (select c, t, f) -> (or f, (czero_nez t, f))
----------------
zengdage wrote:

> Missing fold:
> 
> ```
> c = setcc t, 0, setne
> (select c, t, f) -> (or t, (czero_nez f, t))
> ```
> 
> Proof: https://alive2.llvm.org/ce/z/3JcFbG

Thanks. I have add the case.  BTW,do you still think it should be added in ` RISCVInstrInfoZicond.td` ?

https://github.com/llvm/llvm-project/pull/90208


More information about the llvm-commits mailing list