Add a check that the DILocalVariable fragment size in dbg.declare does not exceed the size of the alloca.
This would have caught the invalid debuginfo regenerated by rustc in https://github.com/llvm/llvm-project/issues/64149.
Differential D158743
[Verifier] Sanity check alloca size against DILocalVariable fragment size nikic on Aug 24 2023, 7:58 AM. Authored by
Details Add a check that the DILocalVariable fragment size in dbg.declare does not exceed the size of the alloca. This would have caught the invalid debuginfo regenerated by rustc in https://github.com/llvm/llvm-project/issues/64149.
Diff Detail
Event Timeline
Comment Actions Use isComplex(), update failing tests. I've split X86/stack-frame-layout-remarks.ll into two files for 64-bit and 32-bit.
Comment Actions Looks like this found a legitimate issue in Clang debuginfo for trivial_abi with non-trivial dtor: https://clang.godbolt.org/z/sWsEMvWas The dbg.declare points to an i1 %nrvo variable, rather than %retval. Comment Actions I've submitted D158972 to fix the clang bug. An additional problem that turned up is that a number of tests that don't specify a target have 64-bit specific debuginfo and thus fail when tested against 32-bit targets. I've fixed these either by tweaking things to be pointer size independent, or by testing these using the x86_64 target. (The Generic/dwarf-public-names.ll test got dropped entirely, because X86/dwarf-public-names.ll already exists and is more extensive to boot.) Comment Actions It looks like we're hitting this new assertion in rust built with llvm @ HEAD in a few places (after @durin42's https://github.com/llvm/llvm-project/commit/1f33911f50294c07f672a49e311776693823d0bc, which fixed some segfaults): @nikic could you please take a look? Also would it be OK if you reverted this temporarily until we fix the rust side (internally we're building rust and clang with llvm close to head and this prevents us from building rust)? Comment Actions Okay, I've reverted this for now. I've posted a small reproducer for the rustc bug in https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20HEAD.20llvm.2Edbg.2Edeclare.2Falloca.20size.20mismatch. |