[all-commits] [llvm/llvm-project] 048a0c: [clang] Support Unified LTO Bitcode Frontend

Matthew Voss via All-commits all-commits at lists.llvm.org
Tue Jul 11 15:14:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 048a0c246908291c82d2f4531d3df45a4c4a8a18
      https://github.com/llvm/llvm-project/commit/048a0c246908291c82d2f4531d3df45a4c4a8a18
  Author: Matthew Voss <matthew.voss at sony.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/PS4CPU.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/asan-unified-lto.ll
    M clang/test/CodeGen/emit-summary-index.c
    A clang/test/CodeGen/unified-lto-pipeline.c
    A clang/test/CodeGenCXX/unified-cfi-lto.cpp
    A clang/test/Driver/unified-lto.c
    M clang/test/Driver/whole-program-vtables.c

  Log Message:
  -----------
  [clang] Support Unified LTO Bitcode Frontend

The unified LTO pipeline creates a single LTO bitcode structure that can
be used by Thin or Full LTO. This means that the LTO mode can be chosen
at link time and that all LTO bitcode produced by the pipeline is
compatible, from an optimization perspective. This makes the behavior of
LTO a bit more predictable by normalizing the set of LTO features
supported by each LTO bitcode file.

Example usage:

  # Compile and link. Select regular LTO at link time.
  clang -flto -funified-lto -fuse-ld=lld foo.c

  # Compile and link. Select ThinLTO at link time.
  clang -flto=thin -funified-lto -fuse-ld=lld foo.c

  # Link separately, using ThinLTO.
  clang -c -flto -funified-lto foo.c  # -flto={full,thin} are identical in
  terms of compilation actions
  clang -flto=thin -fuse-ld=lld foo.o  # pass --lto=thin to ld.lld

  # Link separately, using regular LTO.
  clang -c -flto -funified-lto foo.c
  clang -flto -fuse-ld=lld foo.o  # pass --lto=full to ld.lld

The RFC discussing the details and rational for this change is here:
https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774




More information about the All-commits mailing list