Skip to content

Commit 6bddb95

Browse files
authored
[Backport to 14] Fix SPIRVCopyMemory::validate() (#2770) (#2810)
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 0bc0b33 commit 6bddb95

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
@@ -2106,10 +2106,15 @@ class SPIRVCopyMemory : public SPIRVInstruction, public SPIRVMemoryAccess {
21062106
}
21072107

21082108
void validate() const override {
2109-
assert((getValueType(Id) == getValueType(Source)) && "Inconsistent type");
2110-
assert(getValueType(Id)->isTypePointer() && "Invalid type");
2111-
assert(!(getValueType(Id)->getPointerElementType()->isTypeVoid()) &&
2112-
"Invalid type");
2109+
assert(getValueType(Target)->isTypePointer() && "Invalid Target type");
2110+
assert(getValueType(Source)->isTypePointer() && "Invalid Source type");
2111+
assert(!(getValueType(Target)->getPointerElementType()->isTypeVoid()) &&
2112+
"Invalid Target element type");
2113+
assert(!(getValueType(Source)->getPointerElementType()->isTypeVoid()) &&
2114+
"Invalid Source element type");
2115+
assert(getValueType(Target)->getPointerElementType() ==
2116+
getValueType(Source)->getPointerElementType() &&
2117+
"Mismatching Target and Source element types");
21132118
SPIRVInstruction::validate();
21142119
}
21152120

0 commit comments

Comments
 (0)