Skip to content

Commit 4f1fa68

Browse files
authored
[Backport to 17] Fix SPIRVCopyMemory::validate() (#2770) (#2807)
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 3e6cd73 commit 4f1fa68

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

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

0 commit comments

Comments
 (0)