[Mlir-commits] [mlir] [mlir] Make fold result type check more verbose (PR #76867)

Jakub Kuderski llvmlistbot at llvm.org
Thu Jan 4 07:53:15 PST 2024


================
@@ -611,11 +612,19 @@ void Operation::setSuccessor(Block *block, unsigned index) {
 /// the results of the given op.
 static void checkFoldResultTypes(Operation *op,
                                  SmallVectorImpl<OpFoldResult> &results) {
-  if (!results.empty())
-    for (auto [ofr, opResult] : llvm::zip_equal(results, op->getResults()))
-      if (auto value = ofr.dyn_cast<Value>())
-        assert(value.getType() == opResult.getType() &&
-               "folder produced value of incorrect type");
+  if (results.empty())
+    return;
+
+  for (auto [ofr, opResult] : llvm::zip_equal(results, op->getResults())) {
+    if (auto value = dyn_cast<Value>(ofr)) {
+      if (value.getType() != opResult.getType()) {
+        llvm::errs() << "Folder produced a value of incorrect type for: " << *op
----------------
kuhar wrote:

thanks!

https://github.com/llvm/llvm-project/pull/76867


More information about the Mlir-commits mailing list