[Mlir-commits] [mlir] 340d746 - Turn an assert in mlir-tblgen into a runtime check to be more user friendly (NFC)

Mehdi Amini llvmlistbot at llvm.org
Tue Oct 17 15:53:56 PDT 2023


Author: Mehdi Amini
Date: 2023-10-17T15:53:50-07:00
New Revision: 340d746abae18f6a69bdf4a3bbe4a46990bb755d

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

LOG: Turn an assert in mlir-tblgen into a runtime check to be more user friendly (NFC)

Some user hit this condition, where a crash isn't very friendly.

Added: 
    

Modified: 
    mlir/lib/TableGen/Constraint.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/TableGen/Constraint.cpp b/mlir/lib/TableGen/Constraint.cpp
index d8f240a1af7a4a7..7297bb663376fcb 100644
--- a/mlir/lib/TableGen/Constraint.cpp
+++ b/mlir/lib/TableGen/Constraint.cpp
@@ -30,8 +30,10 @@ Constraint::Constraint(const llvm::Record *record)
     kind = CK_Region;
   } else if (def->isSubClassOf("SuccessorConstraint")) {
     kind = CK_Successor;
-  } else {
-    assert(def->isSubClassOf("Constraint"));
+  } else if(!def->isSubClassOf("Constraint")) {
+    llvm::errs() << "Expected a constraint but got: \n";
+    def->dump();
+    llvm::report_fatal_error("Abort");
   }
 }
 


        


More information about the Mlir-commits mailing list