Add a check to avoid an assertion on malformed input
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16861 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index ce92c9c..70aee05 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -2120,6 +2120,9 @@
if (!isa<PointerType>($3->get()))
ThrowException("Can't load from nonpointer type: " +
(*$3)->getDescription());
+ if (!cast<PointerType>($3->get())->getElementType()->isFirstClassType())
+ ThrowException("Can't load from pointer of non-first-class type: " +
+ (*$3)->getDescription());
$$ = new LoadInst(getVal(*$3, $4), "", $1);
delete $3;
}