Skip to content

Commit a1b6dae

Browse files
authored
[mlir][LLVMIR] Add LLVMDialect check in DIScopeForLLVMFuncOp (#110427)
This PR adds an LLVMDialect check in `DIScopeForLLVMFuncOp` to prevent crashes. Fixes #108390.
1 parent f5815b9 commit a1b6dae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ struct DIScopeForLLVMFuncOp
9191
Location loc = module.getLoc();
9292

9393
MLIRContext *context = &getContext();
94+
if (!context->getLoadedDialect<LLVM::LLVMDialect>()) {
95+
emitError(loc, "LLVM dialect is not loaded.");
96+
return signalPassFailure();
97+
}
9498

9599
// To find a DICompileUnitAttr attached to a parent (the module for
96100
// example), otherwise create a default one.

0 commit comments

Comments
 (0)