diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index f83fe435cd0e..8210350d7154 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -161,12 +161,10 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, const std::string &name, Module *ParentModule) : GlobalValue(PointerType::getUnqual(Ty), Value::FunctionVal, 0, 0, Linkage, name) { + assert(FunctionType::isValidReturnType(getReturnType()) && + !isa(getReturnType()) && "invalid return type"); SymTab = new ValueSymbolTable(); - assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy - || isa(getReturnType())) - && "LLVM functions cannot return aggregate values!"); - // If the function has arguments, mark them as lazily built. if (Ty->getNumParams()) SubclassData = 1; // Set the "has lazy arguments" bit.