[Mlir-commits] [mlir] Only insert the function in the callable map if it resolves. (PR #110348)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Sep 27 17:52:57 PDT 2024


https://github.com/mavann created https://github.com/llvm/llvm-project/pull/110348

First attempt at solving [109649](https://github.com/llvm/llvm-project/issues/109649).

The crash is caused by a null func inserted in the callable map. 



>From 422400f2e18a9da1a3a17b6ae3bac9e0abb56c85 Mon Sep 17 00:00:00 2001
From: Maxime van Noppen <mavann at microsoft.com>
Date: Fri, 27 Sep 2024 20:49:24 -0400
Subject: [PATCH] Only insert the function in the callable map if it resolves.

---
 mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
index 40c83487fd47d5..f84aa6c41ab8c9 100644
--- a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
+++ b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
@@ -59,8 +59,9 @@ LogicalResult MLProgramPipelineGlobals::buildGlobalMap(ModuleOp module) {
       }
 
       auto symbol = mlir::dyn_cast<SymbolRefAttr>(callable);
-      auto *func = getFromSymbol(op, symbol);
-      callableMap[symbol] = func;
+      if (auto *func = getFromSymbol(op, symbol)) {
+        callableMap[symbol] = func;
+      }
     }
     return WalkResult::advance();
   });



More information about the Mlir-commits mailing list