[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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239679 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 27fa3d2b1e35d1b843ad1113556de91cea6b4536..20cec6ebad1ad1498ba6f36ebf02a081554a4d80 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()