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

Vladislav Dzhidzhoev via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 05:41:44 PST 2024


dzhidzhoev wrote:

> Hi,
> 
> We're seeing a crash with this commit and 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).

It seems that the debug info metadata was already malformed before getting into the AsmPrinter pass, probably during the LTO process. I ran into trouble trying to find the root cause of the problem, since the information provided by the reproducer is not sufficient to investigate it.
Could you please provide an IR dump of the earlier stage of compilation or any source code? 

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


More information about the llvm-commits mailing list