[llvm] [SelectionDAG] Prevent combination on inconsistent type in `combineCarryDiamond` (PR #84888)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 04:04:52 PDT 2024


================
@@ -3442,6 +3442,9 @@ static SDValue combineCarryDiamond(SelectionDAG &DAG, const TargetLowering &TLI,
     return SDValue();
   if (Opcode != ISD::UADDO && Opcode != ISD::USUBO)
     return SDValue();
+  // Guarantee identical type of CarryOut
+  if (N->getValueType(0) != Carry0.getValue(1).getValueType())
----------------
XChy wrote:

It can be `i8` in X86 too. If we only handle `i1`, we cannot combine addcarry_fake_carry in X86/addcarry.ll.
I missed the check for Carry1, and it seems that we should replace `MVT::i1` for `and` operator.

https://github.com/llvm/llvm-project/pull/84888


More information about the llvm-commits mailing list