[llvm] [SDAG] (setcc (add nsw a, b), zero, s??) -> (setcc a, b, s??) (PR #175459)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 11 18:41:45 PST 2026
================
@@ -13893,6 +13893,13 @@ SDValue DAGCombiner::visitSETCC(SDNode *N) {
return Combined;
}
+ // (setcc (sub n?w a, b), zero, ?lt) -> (setcc a, b, ?lt)
+ if (isZeroOrZeroSplat(N1) && N0.getOpcode() == ISD::SUB) {
+ if ((N0->getFlags().hasNoSignedWrap() && ISD::isSignedIntSetCC(Cond)) ||
+ (N0->getFlags().hasNoUnsignedWrap() && ISD::isUnsignedIntSetCC(Cond)))
----------------
topperc wrote:
An unsigned comparison with zero is probably going to be written to true/false or eq/ne before we get here.
https://github.com/llvm/llvm-project/pull/175459
More information about the llvm-commits
mailing list