diff --git a/lib/SPIRV/libSPIRV/SPIRVInstruction.h b/lib/SPIRV/libSPIRV/SPIRVInstruction.h index ddba2ab46..ab5856dd3 100644 --- a/lib/SPIRV/libSPIRV/SPIRVInstruction.h +++ b/lib/SPIRV/libSPIRV/SPIRVInstruction.h @@ -2253,10 +2253,15 @@ class SPIRVCopyMemory : public SPIRVInstruction, public SPIRVMemoryAccess { } void validate() const override { - assert((getValueType(Id) == getValueType(Source)) && "Inconsistent type"); - assert(getValueType(Id)->isTypePointer() && "Invalid type"); - assert(!(getValueType(Id)->getPointerElementType()->isTypeVoid()) && - "Invalid type"); + assert(getValueType(Target)->isTypePointer() && "Invalid Target type"); + assert(getValueType(Source)->isTypePointer() && "Invalid Source type"); + assert(!(getValueType(Target)->getPointerElementType()->isTypeVoid()) && + "Invalid Target element type"); + assert(!(getValueType(Source)->getPointerElementType()->isTypeVoid()) && + "Invalid Source element type"); + assert(getValueType(Target)->getPointerElementType() == + getValueType(Source)->getPointerElementType() && + "Mismatching Target and Source element types"); SPIRVInstruction::validate(); }