[llvm] [RISCV] Remove srl from (srl (and X, (1 << C)), C) used as czero.eqz/nez condition. (PR #182598)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 17:25:52 PST 2026


================
@@ -21706,8 +21707,24 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
     if (Cond.getOpcode() == ISD::SETCC && isNullConstant(Cond.getOperand(1))) {
       ISD::CondCode CCVal = cast<CondCodeSDNode>(Cond.getOperand(2))->get();
       if (ISD::isIntEqualitySetCC(CCVal))
-        return DAG.getNode(CCVal == ISD::SETNE ? Opc : InvOpc, SDLoc(N),
-                           N->getValueType(0), Val, Cond.getOperand(0));
+        return DAG.getNode(CCVal == ISD::SETNE ? Opc : InvOpc, SDLoc(N), VT,
+                           Val, Cond.getOperand(0));
+    }
+
+    // Remove SRL from bittest patterns (srl (and X, (1 << C), C)) if the and
----------------
lenary wrote:

Updated your description too, as that's the default commit message when landing this.

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


More information about the llvm-commits mailing list