diff --git a/mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp b/mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp --- a/mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp +++ b/mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp @@ -347,9 +347,15 @@ return emitError(unknownLoc, "no function matching ") << fnID; } if (parsedFunc.getName() != fnName) { - return emitError(unknownLoc, "function name mismatch between OpEntryPoint " - "and OpFunction with ") - << fnID << ": " << fnName << " vs. " << parsedFunc.getName(); + // The deserializer uses "spirv_fn_" as the function name if the input + // SPIR-V blob does not contain a name for it. We should use a more clear + // indication for such case rather than relying on naming details. + if (!parsedFunc.getName().startswith("spirv_fn_")) + return emitError(unknownLoc, + "function name mismatch between OpEntryPoint " + "and OpFunction with ") + << fnID << ": " << fnName << " vs. " << parsedFunc.getName(); + parsedFunc.setName(fnName); } SmallVector interface; while (wordIndex < words.size()) {