[Mlir-commits] [mlir] d5b1643 - [mlir][SPIRV] Fix blocks nested too deeply error.

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue May 19 14:30:31 PDT 2020


Author: MaheshRavishankar
Date: 2020-05-19T14:29:56-07:00
New Revision: d5b1643c74eeae327d85c75fe79fd98edb1014f9

URL: https://github.com/llvm/llvm-project/commit/d5b1643c74eeae327d85c75fe79fd98edb1014f9
DIFF: https://github.com/llvm/llvm-project/commit/d5b1643c74eeae327d85c75fe79fd98edb1014f9.diff

LOG: [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

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
index 5362aa9dee09..73418b831721 100644
--- a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
+++ b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
@@ -707,7 +707,7 @@ static void emitSerializationFunction(const Record *attrClass,
 static void initDispatchSerializationFn(StringRef opVar, raw_ostream &os) {
   os << formatv(
       "LogicalResult Serializer::dispatchToAutogenSerialization(Operation "
-      "*{0}) {{\n ",
+      "*{0}) {{\n",
       opVar);
 }
 
@@ -721,18 +721,15 @@ static void emitSerializationDispatch(const Operator &op, StringRef tabs,
   os << tabs
      << formatv("  return processOp(cast<{0}>({1}));\n",
                 op.getQualCppClassName(), opVar);
-  os << tabs << "} else";
+  os << tabs << "}\n";
 }
 
 /// Generates the epilogue for the function that dispatches the serialization of
 /// the operation.
 static void finalizeDispatchSerializationFn(StringRef opVar, raw_ostream &os) {
-  os << " {\n";
   os << formatv(
-      "    return {0}->emitError(\"unhandled operation serialization\");\n",
+      "  return {0}->emitError(\"unhandled operation serialization\");\n",
       opVar);
-  os << "  }\n";
-  os << "  return success();\n";
   os << "}\n\n";
 }
 


        


More information about the Mlir-commits mailing list