Skip to content

[DWARFLinker] Make synthetic type names deterministic under threading - #209553

Merged
JDevlieghere merged 1 commit into
llvm:mainfrom
JDevlieghere:dsymutil-synthetic-typenames
Jul 19, 2026
Merged

[DWARFLinker] Make synthetic type names deterministic under threading#209553
JDevlieghere merged 1 commit into
llvm:mainfrom
JDevlieghere:dsymutil-synthetic-typenames

Conversation

@JDevlieghere

Copy link
Copy Markdown
Member

The parallel DWARF linker assigns type names concurrently across compile units. SyntheticTypeNameBuilder::addDIETypeName composes a type's name from its referenced types (e.g. template arguments).

For a referenced type it either appends that type's fully-qualified pool key, when the type has already been assigned a type entry, or recomputes the name inline. The inline path only prepended the parent scope when AssignNameToTypeDescriptor was set, so an embedded reference came out fully-qualified when the referenced type happened to be assigned already and unqualified otherwise.

Which branch runs depends on the order type names are assigned, and that order races during the parallel assignment phase. The same type then gets different synthetic names across runs, is entered into the type pool under different keys, and no longer deduplicates deterministically.

Two threaded runs of the same input:

  ...EventInstance:()<{1}CMEvent.{1}detail.{F}Group:()<...>>
  ...EventInstance:()<{F}Group:()<...>>

Always qualify with the parent scope regardless of AssignNameToTypeDescriptor so the inline path agrees with the stored key. Assignment to the type pool stays gated on the flag.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 200384 tests passed
  • 5455 tests skipped

✅ The build succeeded and all tests passed.

@JDevlieghere
JDevlieghere force-pushed the dsymutil-synthetic-typenames branch from fa5a1af to 029b3e3 Compare July 15, 2026 05:13
@JDevlieghere

Copy link
Copy Markdown
Member Author

Friendly (early) ping as I'd really love to backport this into 23.x.

Comment thread llvm/lib/DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp Outdated
@JDevlieghere
JDevlieghere force-pushed the dsymutil-synthetic-typenames branch from 029b3e3 to 08a92e5 Compare July 16, 2026 23:03
The parallel DWARF linker assigns type names concurrently across
compile units. SyntheticTypeNameBuilder::addDIETypeName composes a
type's name from its referenced types (e.g. template arguments).

For a referenced type it either appends that type's fully-qualified
pool key, when the type has already been assigned a type entry, or
recomputes the name inline. The inline path only prepended the parent
scope when AssignNameToTypeDescriptor was set, so an embedded
reference came out fully-qualified when the referenced type happened
to be assigned already and unqualified otherwise.

Which branch runs depends on the order type names are assigned, and
that order races during the parallel assignment phase. The same type
then gets different synthetic names across runs, is entered into the
type pool under different keys, and no longer deduplicates
deterministically.

Two threaded runs of the same input:

  ...EventInstance:()<{1}CMEvent.{1}detail.{F}Group:()<...>>
  ...EventInstance:()<{F}Group:()<...>>

Always qualify with the parent scope regardless of
AssignNameToTypeDescriptor so the inline path agrees with the stored
key. Assignment to the type pool stays gated on the flag.

This removes essentially all of the run-to-run type-unit divergence
on a large threaded link.
@JDevlieghere
JDevlieghere force-pushed the dsymutil-synthetic-typenames branch from 08a92e5 to 37bd5cd Compare July 17, 2026 14:55

@avl-llvm avl-llvm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JDevlieghere
JDevlieghere merged commit 6bcdcb3 into llvm:main Jul 19, 2026
10 of 11 checks passed
@JDevlieghere
JDevlieghere deleted the dsymutil-synthetic-typenames branch July 19, 2026 21:03
@llvm-ci

llvm-ci commented Jul 19, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/35880

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: lang/c/vla/TestVLA.py (857 of 2682)
PASS: lldb-api :: lang/cpp/bool/TestCPPBool.py (858 of 2682)
PASS: lldb-api :: lang/cpp/break-on-initializers/TestBreakOnCPP11Initializers.py (859 of 2682)
UNSUPPORTED: lldb-api :: lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py (860 of 2682)
PASS: lldb-api :: lang/c/step-target/TestStepTarget.py (861 of 2682)
PASS: lldb-api :: lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py (862 of 2682)
PASS: lldb-api :: lang/cpp/builtin_types/char/TestCharTypes.py (863 of 2682)
PASS: lldb-api :: lang/cpp/builtin_types/int/TestIntTypes.py (864 of 2682)
PASS: lldb-api :: lang/cpp/builtin_types/long_int/TestLongIntTypes.py (865 of 2682)
PASS: lldb-api :: lang/cpp/call-function/TestCallCPPFunction.py (866 of 2682)
FAIL: lldb-api :: functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py (867 of 2682)
******************** TEST 'lldb-api :: functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --triple aarch64-unknown-linux-gnu --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --lldb-python-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/local/lib/python3.10/dist-packages --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency -p TestFrameProviderCircularDependency.py
--
Exit Code: 1

Command Output (stdout):
--
Skipping the following test categories: libc++, msvcstl, dsym, pdb, gmodules, debugserver, objc

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_circular_dependency_evaluate_expression_in_get_frame (TestFrameProviderCircularDependency.FrameProviderCircularDependencyTestCase)
Log Files:
 - /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency/Failure_test_circular_dependency_evaluate_expression_in_get_frame.log
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_circular_dependency_handle_command_in_init (TestFrameProviderCircularDependency.FrameProviderCircularDependencyTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_circular_dependency_with_function_replacement (TestFrameProviderCircularDependency.FrameProviderCircularDependencyTestCase)
======================================================================
FAIL: test_circular_dependency_evaluate_expression_in_get_frame (TestFrameProviderCircularDependency.FrameProviderCircularDependencyTestCase)
   Test that calling EvaluateExpression in get_frame_at_index doesn't
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/circular_dependency/TestFrameProviderCircularDependency.py", line 204, in test_circular_dependency_evaluate_expression_in_get_frame
    self.assertIsNotNone(
AssertionError: unexpectedly None : Frame 1 should have function name
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
----------------------------------------------------------------------
Ran 3 tests in 36.026s

FAILED (failures=1)

--

********************
PASS: lldb-api :: lang/cpp/class-loading-via-member-typedef/TestClassLoadingViaMemberTypedef.py (868 of 2682)
PASS: lldb-api :: lang/cpp/chained-calls/TestCppChainedCalls.py (869 of 2682)

@JDevlieghere

Copy link
Copy Markdown
Member Author

/cherry-pick 6bcdcb3

@llvmbot

llvmbot commented Jul 20, 2026

Copy link
Copy Markdown
Member

Failed to cherry-pick: 6bcdcb3

https://github.com/llvm/llvm-project/actions/runs/29783312580

Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request

@JDevlieghere

Copy link
Copy Markdown
Member Author

/cherry-pick 6bcdcb3

@llvmbot

llvmbot commented Jul 20, 2026

Copy link
Copy Markdown
Member

/pull-request #210834

dyung pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants