mirror of
https://github.com/openharmony/third_party_spirv-tools.git
synced 2026-07-15 13:45:35 -04:00
spirv-diff: Fix OpTypeFunction matching w.r.t operand count (#4771)
The code accidentally expected OpTypeFunction operand count to match. This is fixed so that OpTypeFunction instructions with different operand counts are considered not matching.
This commit is contained in:
@@ -2196,16 +2196,18 @@ void Differ::MatchTypeIds() {
|
||||
case SpvOpTypeSampledImage:
|
||||
case SpvOpTypeRuntimeArray:
|
||||
case SpvOpTypePointer:
|
||||
case SpvOpTypeFunction:
|
||||
// Match these instructions when all operands match.
|
||||
assert(src_inst->NumInOperandWords() ==
|
||||
dst_inst->NumInOperandWords());
|
||||
return DoOperandsMatch(src_inst, dst_inst, 0,
|
||||
src_inst->NumInOperandWords());
|
||||
|
||||
case SpvOpTypeFunction:
|
||||
case SpvOpTypeImage:
|
||||
// Match these instructions when all operands match, including the
|
||||
// optional final parameter (if provided in both).
|
||||
// Match function types only if they have the same number of operands,
|
||||
// and they all match.
|
||||
// Match image types similarly, expecting the optional final parameter
|
||||
// to match (if provided in both)
|
||||
if (src_inst->NumInOperandWords() != dst_inst->NumInOperandWords()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user