mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-04 19:17:12 +00:00
[opaque pointer types] Use the pointee type loaded from bitcode when constructing a LoadInst
Now (with a few carefully placed suppressions relating to general type serialization, etc) we can round trip a simple load through bitcode and textual IR without calling getElementType on a PointerType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235221 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4002,15 +4002,16 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
Type *Ty = nullptr;
|
||||
if (OpNum + 3 == Record.size())
|
||||
Ty = getTypeByID(Record[OpNum++]);
|
||||
if (!Ty)
|
||||
Ty = cast<PointerType>(Op->getType())->getElementType();
|
||||
else if (Ty != cast<PointerType>(Op->getType())->getElementType())
|
||||
return Error("Explicit load type does not match pointee type of "
|
||||
"pointer operand");
|
||||
|
||||
unsigned Align;
|
||||
if (std::error_code EC = parseAlignmentValue(Record[OpNum], Align))
|
||||
return EC;
|
||||
I = new LoadInst(Op, "", Record[OpNum+1], Align);
|
||||
|
||||
if (Ty && Ty != I->getType())
|
||||
return Error("Explicit load type does not match pointee type of "
|
||||
"pointer operand");
|
||||
I = new LoadInst(Ty, Op, "", Record[OpNum + 1], Align);
|
||||
|
||||
InstructionList.push_back(I);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user