[PATCH] D29268: [DAGCombine] Combine composition of ADDC(ADDE)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 04:06:24 PST 2017

RKSimon added inline comments.

Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1872
+  if (N1.getOpcode() == ISD::ADDE &&
+      N->isOnlyUserOf(N1.getValue(0).getNode()) &&
+      isNullConstant(N1.getOperand(1)))
zvi wrote:
> deadalnix wrote:
> > Is that important to check this has only one use ? I'd assume that having (adde Y, 0, Carry) + (adde X, Y, Carry) is still preferable to (addc X, (adde Y, 0, Carry)) as it break dependencies between instructions.
> That's a fair point, but here I am following the practice that is common in the DAG Combiner. If you search for "hasOneUse" or "isOnlyUserOf" you can see the conservative approach of avoiding increase in instruction count.
> If you can provide a benchmark that can show this case is an exception, we can discuss the trade-off with data to guide us - and better do it in a follow-up patch.
Are there any situations where the inner ADDE's carry flag will be used by something else?



More information about the llvm-commits mailing list