Skip to content

Commit 823eb1a

Browse files
authored
[SelectionDAG] Add some validation of (S/U)(ADD/SUB)O_CARRY nodes. (#89133)
1 parent 26101e8 commit 823eb1a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9915,6 +9915,18 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
99159915
}
99169916
break;
99179917
}
9918+
case ISD::SADDO_CARRY:
9919+
case ISD::UADDO_CARRY:
9920+
case ISD::SSUBO_CARRY:
9921+
case ISD::USUBO_CARRY:
9922+
assert(VTList.NumVTs == 2 && Ops.size() == 3 &&
9923+
"Invalid add/sub overflow op!");
9924+
assert(VTList.VTs[0].isInteger() && VTList.VTs[1].isInteger() &&
9925+
Ops[0].getValueType() == Ops[1].getValueType() &&
9926+
Ops[0].getValueType() == VTList.VTs[0] &&
9927+
Ops[2].getValueType().isInteger() &&
9928+
"Binary operator types must match!");
9929+
break;
99189930
case ISD::SMUL_LOHI:
99199931
case ISD::UMUL_LOHI: {
99209932
assert(VTList.NumVTs == 2 && Ops.size() == 2 && "Invalid mul lo/hi op!");

0 commit comments

Comments
 (0)