[llvm] [clang] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 01:26:54 PST 2024


jmorse wrote:

Hi,

We're seeing a crash with this reproducer https://gist.github.com/jmorse/b0248c3c9f9195487ffd7c7431a8d15e

llc: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2338: virtual void llvm::DwarfDebug::endFunctionImpl(const llvm::MachineFunction *): Assertion `LScopes.getAbstractScopesList().size() == NumAbstractSubprograms && "getOrCreateAbstractScope() inserted an abstract subprogram scope"' failed.

I'd previously posted the reproducer on https://reviews.llvm.org/D144006#4656728 , however I'd anonymised the IR too much to the point where it was broken in unrelated ways. Revision 2 of the gist, as linked, should produce the crash. I suspect the extra lexical scopes reachable through the retained-nodes list also need to be explored when the LexicalScopes object gets constructed, to avoid scopes being added late and causing containers to invalidate iterators. (Which is what that assertion is there to detect).

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


More information about the llvm-commits mailing list