[SelectionDAG] Added assertions + UNDEF handling for BSWAP node creation.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 13 Jun 2015 15:23:58 +0000 (15:23 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 13 Jun 2015 15:23:58 +0000 (15:23 +0000)
llvm-svn: 239679

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 27fa3d2..20cec6e 100644 (file)
@@ -3082,6 +3082,14 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
     if (OpOpcode == ISD::UNDEF)
       return getUNDEF(VT);
     break;
+  case ISD::BSWAP:
+    assert(VT.isInteger() && VT == Operand.getValueType() &&
+           "Invalid BSWAP!");
+    assert((VT.getScalarSizeInBits() % 16 == 0) &&
+           "BSWAP types must be a multiple of 16 bits!");
+    if (OpOpcode == ISD::UNDEF)
+      return getUNDEF(VT);
+    break;
   case ISD::BITCAST:
     // Basic sanity checking.
     assert(VT.getSizeInBits() == Operand.getValueType().getSizeInBits()