[all-commits] [llvm/llvm-project] 653700: [ThinLTO] Re-order modules for optimal multi-threa...

Alexandre Ganea via All-commits all-commits at lists.llvm.org
Tue Sep 22 08:26:24 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6537004913f3009d896bc30856698e7d22199ba7
      https://github.com/llvm/llvm-project/commit/6537004913f3009d896bc30856698e7d22199ba7
  Author: Alexandre Ganea <alexandre.ganea at ubisoft.com>
  Date:   2020-09-22 (Tue, 22 Sep 2020)

  Changed paths:
    M llvm/include/llvm/LTO/LTO.h
    M llvm/lib/LTO/LTO.cpp
    M llvm/lib/LTO/ThinLTOCodeGenerator.cpp

  Log Message:
  -----------
  [ThinLTO] Re-order modules for optimal multi-threaded processing

Re-use an optimizition from the old LTO API (used by ld64).
This sorts modules in ascending order, based on bitcode size, so that larger modules are processed first. This allows for smaller modules to be process last, and better fill free threads 'slots', and thusly allow for better multi-thread load balancing.

In our case (on dual Intel Xeon Gold 6140, Windows 10 version 2004, two-stage build), this saves 15 sec when linking `clang.exe` with LLD & `-flto=thin`, `/opt:lldltojobs=all`, no ThinLTO cache, -DLLVM_INTEGRATED_CRT_ALLOC=d:\git\rpmalloc.

Before patch: 102 sec
After patch: 85 sec

Inspired by the work done by David Callahan in D60495.

Differential Revision: https://reviews.llvm.org/D87966




More information about the All-commits mailing list