[llvm] [IPO] Avoid crash when DISubprogram has no type (PR #193420)

Jiang Ning via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 00:13:10 PDT 2026


JiangNingHX wrote:

> Automatic ping not working for some reason, so: @llvm/pr-subscribers-debuginfo
> 
> I'd like someone to verify this claim: "DISubprogram::getType() can be null for valid IR, for example with reduced line-table-only debug info"
> 
> Because LangRef says: "The type: field must point at an [DISubroutineType](https://llvm.org/docs/LangRef.html#disubroutinetype)." Either LangRef should clarify that the type can be null, or this is missing a verifier check.

Thanks for the feedback. I followed up on #186557 and got clarification that the reproducer there is a mutated/crafted variant of `llvm/test/Transforms/ArgumentPromotion/dbg.ll`, not IR emitted directly by a frontend such as Clang.

So I agree I should not describe this as known frontend-generated valid IR, nor use reduced line-table-only debug info as justification here. I will update the PR description accordingly.

Given that narrower framing, I think this change is best viewed as a defensive fix to avoid crashing on IR that LLVM currently accepts in practice, even if the provenance/spec status of that IR is still unclear.

Does that seem like the right framing for this patch, or would you prefer handling this exclusively via verifier/LangRef clarification instead?


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


More information about the llvm-commits mailing list