Skip to content

Commit 1f8de71

Browse files
svenvhjsji
authored andcommitted
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 KhronosGroup/SPIRV-LLVM-Translator#2769 Original commit: KhronosGroup/SPIRV-LLVM-Translator@9d2926d27b478f0
1 parent bd2ac52 commit 1f8de71

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h

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

22462246
void validate() const override {
2247-
assert((getValueType(Id) == getValueType(Source)) && "Inconsistent type");
2248-
assert(getValueType(Id)->isTypePointer() && "Invalid type");
2249-
assert(!(getValueType(Id)->getPointerElementType()->isTypeVoid()) &&
2250-
"Invalid type");
2247+
assert(getValueType(Target)->isTypePointer() && "Invalid Target type");
2248+
assert(getValueType(Source)->isTypePointer() && "Invalid Source type");
2249+
assert(!(getValueType(Target)->getPointerElementType()->isTypeVoid()) &&
2250+
"Invalid Target element type");
2251+
assert(!(getValueType(Source)->getPointerElementType()->isTypeVoid()) &&
2252+
"Invalid Source element type");
2253+
assert(getValueType(Target)->getPointerElementType() ==
2254+
getValueType(Source)->getPointerElementType() &&
2255+
"Mismatching Target and Source element types");
22512256
SPIRVInstruction::validate();
22522257
}
22532258

0 commit comments

Comments
 (0)