[PATCH] D29872: Do not legalize large add with addc/adde, introduce addcarry and do it with uaddo/addcarry

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 07:30:02 PDT 2017

deadalnix added inline comments.

Comment at: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:516
   EVT ValueVTs[] = { N->getValueType(0), NVT };
-  SDValue Ops[] = { N->getOperand(0), N->getOperand(1) };
+  SDValue Ops[3] = { N->getOperand(0), N->getOperand(1) };
+  auto C = N->getNumOperands();
zvi wrote:
> Consider using a SmallVector here.
The can only be 2 or 3 element so i think just allocating for 2 on the stack is preferable. This is done in various other places in the codebase already.

Comment at: lib/Target/X86/X86ISelLowering.cpp:23103
+  // Let legalize expand this if it isn't a legal type yet.
+  if (!DAG.getTargetLoweringInfo().isTypeLegal(VT))
zvi wrote:
> I know this also appears at the top of LowerADDC_ADDE_SUBC_SUBE, but why it this check needed?
Because in that case, the backend wants to run some extra legalization code before coming back there.


More information about the llvm-commits mailing list