[llvm] CodeGen: Fix CodeView crashes with empty llvm.dbg.cu (PR #163286)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 14 08:58:48 PDT 2025
dwblaikie wrote:
> Perhaps this could follow a code path more like the DwarfDebug handling - up in AsmPrinter::doInitialization, the DwarfDebug pass is only added if `hasDebugInfo` is true, which is based on `DbgInfoAvailable` which is based on `!debug_compile_units.empty` - whereas CodeViewDebug is added if the raw `llvm.dbg.cu` node exists. Seems like Rather than checking the raw node exists, we should check `hasDebugInfo` in a broader conditional that covers both CV and DWARF.
Hmm, nope, guess not - read further and there's a comment that says "On Windows targets, emit minimal CodeView compiler info even when debug info is disabled"... Not sure what to do with that, in the context of there then being no CUs to base that debug info on.
Maybe check what happens in the more normal case, where there's no `llvm.dbg.cu` node, and try to collapse this non-empty/at-least-one-cu logic so it shares that codepath as much as possible?
https://github.com/llvm/llvm-project/pull/163286
More information about the llvm-commits
mailing list