Skip to content

Commit 4352838

Browse files
authored
[Backport to 18] Fix SPIRVCopyMemory::validate() (#2770) (#2806)
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 e8e7d76 commit 4352838

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

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

0 commit comments

Comments
 (0)