Teach BinaryOperator::createNot to work with packed integer types

llvm-svn: 27124
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 0bd55c9..f28a413 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -923,8 +923,15 @@
 
 BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
                                           Instruction *InsertBefore) {
-  return new BinaryOperator(Instruction::Xor, Op,
-                            ConstantIntegral::getAllOnesValue(Op->getType()),
+  Constant *C;
+  if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) {
+    C = ConstantIntegral::getAllOnesValue(PTy->getElementType());
+    C = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C));
+  } else {
+    C = ConstantIntegral::getAllOnesValue(Op->getType());
+  }
+  
+  return new BinaryOperator(Instruction::Xor, Op, C,
                             Op->getType(), Name, InsertBefore);
 }