[llvm] [X86] Create special case for (a-b) - (a<b) -> sbb a, b (PR #161388)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 03:55:34 PDT 2025
================
@@ -52369,16 +52369,25 @@ static SDValue combineAddOrSubToADCOrSBB(bool IsSub, const SDLoc &DL, EVT VT,
// Do not flip "e > c", where "c" is a constant, because Cmp instruction
// cannot take an immediate as its first operand.
//
- if (EFLAGS.getOpcode() == X86ISD::SUB && EFLAGS.getNode()->hasOneUse() &&
----------------
RKSimon wrote:
Keep this and add an alt check for `IsSub && X == EFLAGS.getValue(0)` - its better if we don't generate the NewSub node unless we know the folds are going to succeed - we have a lot of oneuse checks below that might get affected by temp nodes that persist for a bit.
https://github.com/llvm/llvm-project/pull/161388
More information about the llvm-commits
mailing list