[llvm] 766cd95 - [DAG] getNode - assert that ADDO/SUBO nodes have the correct ops + types

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 03:24:12 PDT 2022


Author: Simon Pilgrim
Date: 2022-07-20T11:23:58+01:00
New Revision: 766cd95481ef853f260c78d6868f6cd428527a5c

URL: https://github.com/llvm/llvm-project/commit/766cd95481ef853f260c78d6868f6cd428527a5c
DIFF: https://github.com/llvm/llvm-project/commit/766cd95481ef853f260c78d6868f6cd428527a5c.diff

LOG: [DAG] getNode - assert that ADDO/SUBO nodes have the correct ops + types

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 65b14d447d11..fe82a8291fbd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -9037,6 +9037,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList,
 #endif
 
   switch (Opcode) {
+  case ISD::SADDO:
+  case ISD::UADDO:
+  case ISD::SSUBO:
+  case ISD::USUBO:
+    assert(VTList.NumVTs == 2 && Ops.size() == 2 &&
+           "Invalid add/sub overflow op!");
+    assert(VTList.VTs[0].isInteger() && VTList.VTs[1].isInteger() &&
+           Ops[0].getValueType() == Ops[1].getValueType() &&
+           Ops[0].getValueType() == VTList.VTs[0] &&
+           "Binary operator types must match!");
+    break;
   case ISD::STRICT_FP_EXTEND:
     assert(VTList.NumVTs == 2 && Ops.size() == 2 &&
            "Invalid STRICT_FP_EXTEND!");


        


More information about the llvm-commits mailing list