[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:53:53 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Maxime (mavann)

<details>
<summary>Changes</summary>

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. 



---
Full diff: https://github.com/llvm/llvm-project/pull/110348.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp (+3-2) 


``````````diff
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();
   });

``````````

</details>


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


More information about the Mlir-commits mailing list