[all-commits] [llvm/llvm-project] 6f9646: [ELF] Parallelize --gc-sections mark phase (#189321)
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Apr 1 23:42:22 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6f9646a598f25efa3c4db066d2d51fb248b13526
https://github.com/llvm/llvm-project/commit/6f9646a598f25efa3c4db066d2d51fb248b13526
Author: Fangrui Song <i at maskray.me>
Date: 2026-04-02 (Thu, 02 Apr 2026)
Changed paths:
M lld/ELF/MarkLive.cpp
Log Message:
-----------
[ELF] Parallelize --gc-sections mark phase (#189321)
Add `markParallel` using level-synchronized `parallelFor`. Each BFS
level is processed in parallel; newly discovered sections are collected
in per-thread queues and merged for the next level.
The parallel path is used when `!TrackWhyLive && partitions.size()==1`.
`parallelFor` naturally degrades to serial when `--threads=1`.
Uses depth-limited inline recursion (depth<3) and optimistic
load-then-exchange dedup for best performance.
Linking a Release+Asserts clang (--gc-sections, --time-trace) on an old
x86-64:
8 threads: markLive 315ms -> 82ms (-234ms). Total 1562ms -> 1350ms
(1.16x).
16 threads: markLive 199ms -> 50ms (-149ms). Total 1017ms -> 862ms
(1.18x).
and on Apple M4: markLive 61ms -> 13ms. Total 317.3ms -> 272.7ms
(1.16x).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list