[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

Vladislav Dzhidzhoev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 05:51:38 PST 2023


dzhidzhoev added a comment.

In D144006#4656728 <https://reviews.llvm.org/D144006#4656728>, @jmorse wrote:

> Hi,
>
> Just to note that we've been seeing LTO crashes as a result of rG3b449bd46a11a <https://reviews.llvm.org/rG3b449bd46a11a55a40cbc0016a99b202fa05248e> (now reverted on trunk), which @StephenTozer has kindly reduced down to:
>
>   https://gist.github.com/jmorse/b0248c3c9f9195487ffd7c7431a8d15e
>
> Which triggers the assertion: DwarfDebug.cpp:2335: virtual void llvm::DwarfDebug::endFunctionImpl(const llvm::MachineFunction *): Assertion `LScopes.getAbstractScopesList().size() == NumAbstractSubprograms && "getOrCreateAbstractScope() inserted an abstract subprogram scope"' failed. If you revert-the-revert rG6beddd668 <https://reviews.llvm.org/rG6beddd668adf8e6bddbbc58ec02e4728dd889e9e> that is.
>
> I haven't familiarised myself with this patch series (while greatly appreciating that it exists!), so perhaps this is already obvious but: This particular assertion is a check that no additional lexical scopes are discovered during DWARF emission that weren't found during the earlier building of the lexical-scopes-map, which enumerates all scopes/inlining-chains for all instructions' DebugLocs. If any more unexpectedly appear after that, I believe there's a risk that a container for lexical scopes gets reallocated, causing random crashes. I see there are now types in the retainedNodes field for DISubprograms with "scope" fields (EDIT: !53 in the reproducer), I imagine that the discovery of those lexical scopes which weren't reachable from instructions might be causing the assertion.

I appreciate your help! Can I ask you how to reproduce that crash? When I run llc or llvm-lto on the gist, the assertion is triggered

  Assertion failed: (((LinkageName.empty() || DeclLinkageName.empty()) || LinkageName == DeclLinkageName) && "decl has a linkage name and it is different"), function applySubprogramDefinitionAttributes, file DwarfUnit.cpp, line 1222.

that persists even with this commit reverted. Are you sure that the reproducer was correctly reduced?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006



More information about the llvm-commits mailing list