[PATCH] D57169: [X86] Fold X86ISD::SBB(ISD::SUB(X, Y), 0) -> X86ISD::SBB(X, Y) (PR25858)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 12:53:38 PST 2019
RKSimon planned changes to this revision.
RKSimon marked an inline comment as done.
RKSimon added inline comments.
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:40510
+ SDValue Op1 = N->getOperand(1);
+ if (Op0.getOpcode() == ISD::SUB && isNullConstant(Op1))
+ return DAG.getNode(X86ISD::SBB, SDLoc(N), N->getVTList(), Op0.getOperand(0),
----------------
craig.topper wrote:
> This is only valid if the flag result of the SBB is dead. If the sub(X,Y) had a borrow, that information was silently dropped. The SBB output flag should only be calculating the borrow from the result of the subtract minus the C flag. By folding them it would calculate the C flag based on the combined subtraction.
>
> This is the same reason DAGCombiner::visitADDCARRYLike has a check that the ADDCARRY flag result isn't used.
LOL - I realised that walking home. I'll take another look.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57169/new/
https://reviews.llvm.org/D57169
More information about the llvm-commits
mailing list