spirv-diff: Allow no SpecId (#4904)
diff --git a/source/diff/diff.cpp b/source/diff/diff.cpp
index 17750ff..7ed41de 100644
--- a/source/diff/diff.cpp
+++ b/source/diff/diff.cpp
@@ -1284,8 +1284,15 @@
return src_spec_id == dst_spec_id;
}
- // There is no spec id, this is not valid.
- assert(false && "Unreachable");
+ // There is no SpecId decoration, while not practical, still valid.
+ // SpecConstantOp don't have SpecId and can be matched by operands
+ if (src_inst->opcode() == SpvOpSpecConstantOp) {
+ if (src_inst->NumInOperandWords() == dst_inst->NumInOperandWords()) {
+ return DoOperandsMatch(src_inst, dst_inst, 0,
+ src_inst->NumInOperandWords());
+ }
+ }
+
return false;
}