[Mlir-commits] [mlir] [MLIR][MLProgram] Fix crash in mlprogram-pipeline-globals on unresolvable callees (PR #189244)

Hocky Yudhiono llvmlistbot at llvm.org
Tue Mar 31 01:37:28 PDT 2026


================
@@ -219,6 +219,31 @@ func.func @call_indirect_load() {
 
 // -----
 
+// Calling a function that is declared but not defined in this module (no body)
+// should not crash - the pass should bail out gracefully.
+// See https://github.com/llvm/llvm-project/issues/109649
+
+// CHECK-LABEL: @global_variable
+ml_program.global private mutable @global_variable(dense<4> : tensor<4xi32>) : tensor<4xi32>
+
+// External function declaration (no body).
+func.func private @external_func() -> ()
----------------
hockyy wrote:

```
hocky at hocky:~/llvm-project/build_clion$ mlir-opt what.mlir --mlir-very-unsafe-disable-verifier-on-parsing
"builtin.module"() ({
  "ml_program.global"() <{is_mutable, sym_name = "global_variable", sym_visibility = "private", type = tensor<4xi32>, value = dense<4> : tensor<4xi32>}> : () -> ()
  "func.func"() <{function_type = () -> (), sym_name = "call_external"}> ({
    %0 = "ml_program.global_load"() <{global = @global_variable}> : () -> tensor<4xi32>
    "func.call"() <{callee = @external_func}> : () -> ()
    %1 = "ml_program.global_load"() <{global = @global_variable}> : () -> tensor<4xi32>
    "func.return"() : () -> ()
  }) : () -> ()
}) : () -> ()

hocky at hocky:~/llvm-project/build_clion$ mlir-opt what.mlir --mlir-very-unsafe-disable-verifier-on-parsing -pass-pipeline="builtin.module(mlprogram-pipeline-globals)"
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: mlir-opt what.mlir --mlir-very-unsafe-disable-verifier-on-parsing -pass-pipeline=builtin.module(mlprogram-pipeline-globals)
 #0 0x000062a380739c18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/hocky/llvm-project/build_clion/bin/mlir-op
```

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


More information about the Mlir-commits mailing list