diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-04-06 20:59:48 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-04-06 20:59:48 +0000 |
commit | 15d9a4c49c3198d77ea74e03f71133737d2e91da (patch) | |
tree | 5563651a21ceb3270fd5567d455ce15c4e16b77c /llvm/lib/AsmParser/LLParser.cpp | |
parent | c437888f5af7ab582bfb10a2159c06e07b7cbe57 (diff) | |
download | bcm5719-llvm-15d9a4c49c3198d77ea74e03f71133737d2e91da.tar.gz bcm5719-llvm-15d9a4c49c3198d77ea74e03f71133737d2e91da.zip |
[opaque pointer type] Avoid using PointerType::getElementType when parsing IR
A few calls are left in for error checking - but I'm commenting those
out & trying to build some IR tests (aiming for Argument Promotion to
start with). When I get any of these tests passing I may add flag to
disable the checking so I can add tests that pass with the assertion in
place.
llvm-svn: 234206
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index d735063d5dc..ce1ee96bbe8 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -5279,7 +5279,7 @@ int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) { Lex.Lex(); } - Type *Ty = nullptr; + Type *Ty; LocTy ExplicitTypeLoc = Lex.getLoc(); if (ParseType(Ty) || ParseToken(lltok::comma, "expected comma after load's type") || @@ -5288,8 +5288,7 @@ int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) { ParseOptionalCommaAlign(Alignment, AteExtraComma)) return true; - if (!Val->getType()->isPointerTy() || - !cast<PointerType>(Val->getType())->getElementType()->isFirstClassType()) + if (!Val->getType()->isPointerTy() || !Ty->isFirstClassType()) return Error(Loc, "load operand must be a pointer to a first class type"); if (isAtomic && !Alignment) return Error(Loc, "atomic load must have explicit non-zero alignment"); @@ -5300,7 +5299,7 @@ int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) { return Error(ExplicitTypeLoc, "explicit pointee type doesn't match operand's pointee type"); - Inst = new LoadInst(Val, "", isVolatile, Alignment, Ordering, Scope); + Inst = new LoadInst(Ty, Val, "", isVolatile, Alignment, Ordering, Scope); return AteExtraComma ? InstExtraComma : InstNormal; } |