Skip to content

Commit 90ad499

Browse files
authored
[Backport to 15] Fix SPIRVCopyMemory::validate() (#2770) (#2809)
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 (cherry picked from commit 9d2926d)
1 parent 2f888a2 commit 90ad499

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
@@ -2099,10 +2099,15 @@ class SPIRVCopyMemory : public SPIRVInstruction, public SPIRVMemoryAccess {
20992099
}
21002100

21012101
void validate() const override {
2102-
assert((getValueType(Id) == getValueType(Source)) && "Inconsistent type");
2103-
assert(getValueType(Id)->isTypePointer() && "Invalid type");
2104-
assert(!(getValueType(Id)->getPointerElementType()->isTypeVoid()) &&
2105-
"Invalid type");
2102+
assert(getValueType(Target)->isTypePointer() && "Invalid Target type");
2103+
assert(getValueType(Source)->isTypePointer() && "Invalid Source type");
2104+
assert(!(getValueType(Target)->getPointerElementType()->isTypeVoid()) &&
2105+
"Invalid Target element type");
2106+
assert(!(getValueType(Source)->getPointerElementType()->isTypeVoid()) &&
2107+
"Invalid Source element type");
2108+
assert(getValueType(Target)->getPointerElementType() ==
2109+
getValueType(Source)->getPointerElementType() &&
2110+
"Mismatching Target and Source element types");
21062111
SPIRVInstruction::validate();
21072112
}
21082113

0 commit comments

Comments
 (0)