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.
llvm-svn: 14646
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index 01c7b3f..9022e91 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/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() {