Skip to content

Commit d5b1643

Browse files
author
MaheshRavishankar
committed
[mlir][SPIRV] Fix blocks nested too deeply error.
Issue arises due to a giant if/else if/else/... construct. Changing them to just ifs. Differential Revision: https://reviews.llvm.org/D80245
1 parent 21b0eff commit d5b1643

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ static void emitSerializationFunction(const Record *attrClass,
707707
static void initDispatchSerializationFn(StringRef opVar, raw_ostream &os) {
708708
os << formatv(
709709
"LogicalResult Serializer::dispatchToAutogenSerialization(Operation "
710-
"*{0}) {{\n ",
710+
"*{0}) {{\n",
711711
opVar);
712712
}
713713

@@ -721,18 +721,15 @@ static void emitSerializationDispatch(const Operator &op, StringRef tabs,
721721
os << tabs
722722
<< formatv(" return processOp(cast<{0}>({1}));\n",
723723
op.getQualCppClassName(), opVar);
724-
os << tabs << "} else";
724+
os << tabs << "}\n";
725725
}
726726

727727
/// Generates the epilogue for the function that dispatches the serialization of
728728
/// the operation.
729729
static void finalizeDispatchSerializationFn(StringRef opVar, raw_ostream &os) {
730-
os << " {\n";
731730
os << formatv(
732-
" return {0}->emitError(\"unhandled operation serialization\");\n",
731+
" return {0}->emitError(\"unhandled operation serialization\");\n",
733732
opVar);
734-
os << " }\n";
735-
os << " return success();\n";
736733
os << "}\n\n";
737734
}
738735

0 commit comments

Comments
 (0)