[Mlir-commits] [mlir] [mlir] Fix a crash in ensure-debug-info-scope-on-llvm-func. (PR #178337)
Christian Ulmann
llvmlistbot at llvm.org
Wed Jan 28 03:48:18 PST 2026
================
@@ -121,10 +121,13 @@ static void setLexicalBlockFileAttr(Operation *op) {
// We assemble the full inline stack so the parent of this loc must be a
// function
auto funcOp = op->getParentOfType<LLVM::LLVMFuncOp>();
- if (auto funcOpLoc = llvm::dyn_cast_if_present<FusedLoc>(funcOp.getLoc())) {
- scopeAttr = cast<LLVM::DISubprogramAttr>(funcOpLoc.getMetadata());
- op->setLoc(
- CallSiteLoc::get(getNestedLoc(op, scopeAttr, calleeLoc), callerLoc));
+ if (funcOp) {
----------------
Dinistro wrote:
```suggestion
if (auto funcOp = op->getParentOfType<LLVM::LLVMFuncOp>()) {
```
Nit: This is slightly more elegant
https://github.com/llvm/llvm-project/pull/178337
More information about the Mlir-commits
mailing list