Empty entry-function triggers the following assertion:
llvm/lib/IR/Mangler.cpp:38: void getNameWithPrefixImpl(llvm::raw_ostream &, const llvm::Twine &, (anonymous namespace)::ManglerPrefixTy, const llvm::DataLayout &, char): Assertion `!Name.empty() && "getNameWithPrefix requires non-empty name"' failed.
Throw an error if entry-function is empty.
I think you can omit the IR entirely since you'll error out before attempting to parse it: