Skip to content

Commit 9d2926d

Browse files
authored
Fix SPIRVCopyMemory::validate() (#2770)
The asserts should be checking the `Target` member variable; `Id` is not used for this class. Only fix the wrong asserts for now; proper handling and testing of `OpCopyMemory` will be done in a followup commit. Contributes to #2769
1 parent ae8fa38 commit 9d2926d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/SPIRV/libSPIRV/SPIRVInstruction.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,10 +2253,15 @@ class SPIRVCopyMemory : public SPIRVInstruction, public SPIRVMemoryAccess {
22532253
}
22542254

22552255
void validate() const override {
2256-
assert((getValueType(Id) == getValueType(Source)) && "Inconsistent type");
2257-
assert(getValueType(Id)->isTypePointer() && "Invalid type");
2258-
assert(!(getValueType(Id)->getPointerElementType()->isTypeVoid()) &&
2259-
"Invalid type");
2256+
assert(getValueType(Target)->isTypePointer() && "Invalid Target type");
2257+
assert(getValueType(Source)->isTypePointer() && "Invalid Source type");
2258+
assert(!(getValueType(Target)->getPointerElementType()->isTypeVoid()) &&
2259+
"Invalid Target element type");
2260+
assert(!(getValueType(Source)->getPointerElementType()->isTypeVoid()) &&
2261+
"Invalid Source element type");
2262+
assert(getValueType(Target)->getPointerElementType() ==
2263+
getValueType(Source)->getPointerElementType() &&
2264+
"Mismatching Target and Source element types");
22602265
SPIRVInstruction::validate();
22612266
}
22622267

0 commit comments

Comments
 (0)