[llvm] [DAG] optimize llvm.ucmp for 1-bit inputs to return subtraction of operands (PR #150058)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 10:22:15 PDT 2025
================
@@ -10942,6 +10942,10 @@ SDValue TargetLowering::expandCMP(SDNode *Node, SelectionDAG &DAG) const {
SDValue IsLT = DAG.getSetCC(dl, BoolVT, LHS, RHS, LTPredicate);
SDValue IsGT = DAG.getSetCC(dl, BoolVT, LHS, RHS, GTPredicate);
+ if (isa<VTSDNode>(RHS->getOperand(1)) &&
+ cast<VTSDNode>(RHS->getOperand(1))->getVT().getScalarSizeInBits() == 1) {
+ return DAG.getNode(ISD::SUB, dl, VT, LHS, RHS);
----------------
topperc wrote:
This code leaves the newly created `IsLT` and `IsGT` as dead nodes.
https://github.com/llvm/llvm-project/pull/150058
More information about the llvm-commits
mailing list