diff --git a/lib/SPIRV/libSPIRV/SPIRVInstruction.h b/lib/SPIRV/libSPIRV/SPIRVInstruction.h index 2fb1baef1..a591ac039 100644 --- a/lib/SPIRV/libSPIRV/SPIRVInstruction.h +++ b/lib/SPIRV/libSPIRV/SPIRVInstruction.h @@ -2107,10 +2107,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(); }