From 6013d84392fa1b7683921f9d3b6aedb357233e06 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Thu, 13 May 2021 15:44:21 -0700 Subject: [OpaquePtr] Make loads and stores work with opaque pointers Don't check that types match when the pointer operand is an opaque pointer. I would separate the Assembler and Verifier changes, but verify-uselistorder in the Assembler test ends up running the verifier. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102450 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 25edf24..b2794b3 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3844,12 +3844,11 @@ Error BitcodeReader::parseBitcodeInto(Module *M, bool ShouldLazyLoadMetadata, Error BitcodeReader::typeCheckLoadStoreInst(Type *ValType, Type *PtrType) { if (!isa(PtrType)) return error("Load/Store operand is not a pointer type"); - Type *ElemType = cast(PtrType)->getElementType(); - if (ValType && ValType != ElemType) + if (!cast(PtrType)->isOpaqueOrPointeeTypeMatches(ValType)) return error("Explicit load/store type does not match pointee " "type of pointer operand"); - if (!PointerType::isLoadableOrStorableType(ElemType)) + if (!PointerType::isLoadableOrStorableType(ValType)) return error("Cannot load/store from pointer"); return Error::success(); } -- cgit v1.1