[all-commits] [llvm/llvm-project] 70d62e: [Clang] Rework LTO mode selection to be a Toolchai...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Jun 3 06:28:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70d62e1e10907e1bd6dd0e92968acbf6fe58af37
      https://github.com/llvm/llvm-project/commit/70d62e1e10907e1bd6dd0e92968acbf6fe58af37
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M clang/include/clang/Driver/Driver.h
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/AIX.cpp
    M clang/lib/Driver/ToolChains/AMDGPU.cpp
    M clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
    M clang/lib/Driver/ToolChains/AVR.cpp
    M clang/lib/Driver/ToolChains/BareMetal.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/Cuda.cpp
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Driver/ToolChains/FreeBSD.cpp
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/HIPAMD.cpp
    M clang/lib/Driver/ToolChains/Haiku.cpp
    M clang/lib/Driver/ToolChains/Hexagon.cpp
    M clang/lib/Driver/ToolChains/MSVC.cpp
    M clang/lib/Driver/ToolChains/MinGW.cpp
    M clang/lib/Driver/ToolChains/OpenBSD.cpp
    M clang/lib/Driver/ToolChains/PS4CPU.cpp
    M clang/lib/Driver/ToolChains/SPIRV.cpp
    M clang/lib/Driver/ToolChains/Serenity.cpp
    M clang/lib/Driver/ToolChains/WebAssembly.cpp

  Log Message:
  -----------
  [Clang] Rework LTO mode selection to be a Toolchain property (#201155)

Summary:
Currently, the LTO mode is a property of the Driver, which makes sense
because it is used to set up phases. However, we currently have `-flto`
and `-foffload-lto`, which is a split that doesn't fully work with the
full context of a heterogenous compilation as it is 'all-or-nothing'.

This PR seeks to be mostly NFC for now, just moving the queries to a
per-toolchain interface rather than the static driver mode setting we
have right now. The *single* use of this before ToolChains are created
is for the Webassembly toolchain to set an include path. This is now
just a direct check on the flag, which is consistent. In the future they
could shift to fat LTO objects as well.

The main goal for the PR is to allow the GPU / Offloading toolchains to
specify their "real" LTO behavior. Right now SPIR-V and AMDGCN both
default to LTO, but rather than re-use the LTO handling we hack through
the driver phases to override it. Allowing this split would let us
heavily simplify this logic.

Co-authored-by: Cursor <cursoragent at cursor.com>

---------

Co-authored-by: Cursor <cursoragent at cursor.com>



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