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

Paweł Bylica via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 14:05:38 PST 2022


chfast added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:52114
+  // iff the flag result is dead.
+  if (LHS.getOpcode() == ISD::ADD && isNullConstant(RHS) &&
+      !N->hasAnyUseOfValue(1))
----------------
Is it guaranteed the constant is in RHS?


================
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),
----------------
I copied `!N->hasAnyUseOfValue(1)` from the combineSBB() but I don't understand why this is needed. There is no negative test for 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