[PATCH] D80245: [mlir][SPIRV] Fix blocks nested too deeply error.

Mahesh Ravishankar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 14:19:12 PDT 2020


mravishankar created this revision.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, bader, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: antiagainst.
Herald added a project: LLVM.
antiagainst accepted this revision.
antiagainst added a comment.
This revision is now accepted and ready to land.

Actually less code! :)


Issue arises due to a giant if/else if/else/... construct. Changing
them to just ifs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80245

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


Index: mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
+++ mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
@@ -707,7 +707,7 @@
 static void initDispatchSerializationFn(StringRef opVar, raw_ostream &os) {
   os << formatv(
       "LogicalResult Serializer::dispatchToAutogenSerialization(Operation "
-      "*{0}) {{\n ",
+      "*{0}) {{\n",
       opVar);
 }
 
@@ -721,18 +721,15 @@
   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";
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80245.265037.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/76b0e6b0/attachment.bin>


More information about the llvm-commits mailing list