[llvm] [PowerPC] Combine sub within setcc back to sext (PR #66978)
Amy Kwan via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 08:10:18 PST 2024
================
@@ -14425,15 +14428,52 @@ SDValue PPCTargetLowering::combineSetCC(SDNode *N,
// x != 0-y --> x+y != 0
if (RHS.getOpcode() == ISD::SUB && isNullConstant(RHS.getOperand(0)) &&
RHS.hasOneUse()) {
- SDLoc DL(N);
- SelectionDAG &DAG = DCI.DAG;
- EVT VT = N->getValueType(0);
- EVT OpVT = LHS.getValueType();
SDValue Add = DAG.getNode(ISD::ADD, DL, OpVT, LHS, RHS.getOperand(1));
return DAG.getSetCC(DL, VT, Add, DAG.getConstant(0, DL, OpVT), CC);
}
}
+ if (CC == ISD::SETULT && isa<ConstantSDNode>(RHS)) {
----------------
amy-kwan wrote:
nit: I think it is not ideal to have `isa<>` followed by `cast<>`?
https://github.com/llvm/llvm-project/pull/66978
More information about the llvm-commits
mailing list