[all-commits] [llvm/llvm-project] 765580: [mlir] Fix crash in dialect conversion for detache...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Mar 13 08:50:16 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 765580dee2e27309968effe13a34b878db2e6e35
      https://github.com/llvm/llvm-project/commit/765580dee2e27309968effe13a34b878db2e6e35
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-03-13 (Fri, 13 Mar 2026)

  Changed paths:
    M mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    A mlir/test/Conversion/ConvertToSPIRV/detached-root.mlir

  Log Message:
  -----------
  [mlir] Fix crash in dialect conversion for detached root ops (#185068)

When running dialect conversion with --no-implicit-module, the root op
is
parsed without a wrapping module and then detached from its temporary
parsing
block (block == nullptr). If a conversion pattern replaces this detached
root
op, ReplaceOperationRewrite::commit() would crash with a null pointer
dereference when calling op->getBlock()->getOperations().remove(op).

Fix this with two complementary changes:

1. In ReplaceOperationRewrite::commit(), add a guard that calls
   reportFatalInternalError when op->getBlock() is null. This turns the
   opaque null-pointer crash into a clear diagnostic pointing at the API
   misuse.

2. Make --convert-func-to-spirv explicitly reject detached top-level ops
at
pass startup with a clear diagnostic rather than letting the conversion
   framework abort with a fatal error.

Add a regression test in mlir/test/Conversion/ConvertToSPIRV/ that
verifies
the diagnostic is emitted instead of crashing.

Fixes #60491
Assisted-by: Claude Code



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list