[PATCH] D120435: [X86] Combine ADC(ADD(X,Y),0,Carry) -> ADC(X,Y,Carry)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 14:15:06 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:52115
+  if (LHS.getOpcode() == ISD::ADD && isNullConstant(RHS) &&
+      !N->hasAnyUseOfValue(1))
+    return DAG.getNode(X86ISD::ADC, SDLoc(N), N->getVTList(), LHS.getOperand(0),
----------------
chfast wrote:
> I copied `!N->hasAnyUseOfValue(1)` from the combineSBB() but I don't understand why this is needed. There is no negative test for it.
That checks that the EFLAG result is unused. Doing this combine can change the value of the C flag produced by the ADC so we need to make sure no one is looking at it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120435/new/

https://reviews.llvm.org/D120435



More information about the llvm-commits mailing list