Mehdi Amini e84f9cacc9
[MLIR][NVVM] Fix segfault when translating NVVM ops outside a function (#188735)
When a GPU barrier op was placed at the top level of a gpu.module (not
inside a gpu.func), the pass pipeline lowered it to nvvm.barrier0 at
module scope. During LLVM IR translation, translateModuleToLLVMIR called
NVVMDialectLLVMIRTranslationInterface::convertOperation for the
misplaced op, which reached createIntrinsicCall with an IRBuilder that
had no active insertion point (null GetInsertBlock()), causing a null
dereference crash.

The fix adds a guard at the top of the NVVM translation interface's
convertOperation: all NVVM ops are instruction-level and require an
active insertion point. If the insert block is null, the op must be
misplaced, so we return a proper MLIR error instead of crashing.

Fixes #186642

Assisted-by: Claude Code
2026-03-27 12:24:38 +01:00
..