Find bugs sooner rather than later.  In this case, don't allow the creation
of instructions that don't have a first-class or void type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14646 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 01c7b3f..9022e91 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -31,6 +31,9 @@
 
 Value::Value(const Type *ty, unsigned scid, const std::string &name)
   : SubclassID(scid), Ty(checkType(ty)), Name(name) {
+  if (!isa<Constant>(this) && !isa<BasicBlock>(this))
+    assert((Ty->isFirstClassType() || Ty == Type::VoidTy) &&
+           "Cannot create non-first-class values except for constants!");
 }
 
 Value::~Value() {