[clang] [llvm] [clang][DebugInfo] Add virtuality call-site target information in DWARF. (PR #167666)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 19 14:12:54 PST 2026
ilovepi wrote:
> @ilovepi I am sorry for the crash. Thanks for taking the time to upload the reproducer (unreduced). Looking at the function where the assertion is raised:
>
It's no problem. Anything non-trivial is highly likely to break _something_ _somewhere_. :)
> ```
> dwarf::Attribute
> DwarfCompileUnit::getDwarf5OrGNUAttr(dwarf::Attribute Attr) const {
> if (!useGNUAnalogForDwarf5Feature())
> return Attr;
> switch (Attr) {
> case dwarf::DW_AT_call_all_calls:
> return dwarf::DW_AT_GNU_all_call_sites;
> case dwarf::DW_AT_call_target:
> return dwarf::DW_AT_GNU_call_site_target;
> case dwarf::DW_AT_call_target_clobbered:
> return dwarf::DW_AT_GNU_call_site_target_clobbered;
> case dwarf::DW_AT_call_origin:
> return dwarf::DW_AT_abstract_origin;
> case dwarf::DW_AT_call_return_pc:
> return dwarf::DW_AT_low_pc;
> case dwarf::DW_AT_call_value:
> return dwarf::DW_AT_GNU_call_site_value;
> case dwarf::DW_AT_call_tail_call:
> return dwarf::DW_AT_GNU_tail_call;
> default:
> llvm_unreachable("DWARF5 attribute with no GNU analog");
> }
> }
> ```
>
> The function `getDwarf5OrGNUAttr` is called by new code (`addCallSiteTargetForIndirectCalls`) in the patch:
>
> ```
> // Create call_target connections for indirect calls.
> auto addCallSiteTargetForIndirectCalls = [&](const MachineInstr *MI,
> DIE &CallSiteDIE) {
> ...
> CU.addDIEEntry(CallSiteDIE,
> CU.getDwarf5OrGNUAttr(dwarf::DW_AT_LLVM_virtual_call_origin),
> *CalleeDIE);
> ...
> };
> ```
>
> The patch added a new LLVM attribute `LLVM_virtual_call_origin` which is not included in the `switch` statement, in `getDwarf5OrGNUAttr` causing the assertion.
>
> A temporal fix for your specific build, could be
>
> ```
> ...
> CU.addDIEEntry(CallSiteDIE,
> dwarf::DW_AT_LLVM_virtual_call_origin, <-- Don't invoke getDwarf5OrGNUAttr(...)
> *CalleeDIE);
> ...
> ```
>
> Do you have a reduced test? Thanks.
creduce is still running. I'm probably calling it a day soon, but I'll try to check later and get you something smaller if its done.
you can maybe get something faster w/ llvm-reduce though if you dump the IR (assuming it isn't something that requied the clang side changes too). I'm just running the in tree reduction script from the reproducer, so that's creduce/cvise for now.
https://github.com/llvm/llvm-project/pull/167666
More information about the llvm-commits
mailing list