[all-commits] [llvm/llvm-project] 72acd0: Pass split-machine-functions to code generator whe...

Junfeng Dong via All-commits all-commits at lists.llvm.org
Wed Mar 23 08:55:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72acd042bad35f78232f17addc02196a7af1a6e9
      https://github.com/llvm/llvm-project/commit/72acd042bad35f78232f17addc02196a7af1a6e9
  Author: Junfeng Dong <jfdong at fb.com>
  Date:   2022-03-23 (Wed, 23 Mar 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    A clang/test/Driver/fsplit-machine-functions2.c

  Log Message:
  -----------
  Pass split-machine-functions to code generator when flto is used

-fsplit-machine-functions is an optimization in codegen phase. when -flto is use, clang generate IR bitcode in .o files, and linker will call into these codegen optimization passes. Current clang driver doesn't pass this option to linker when both -fsplit-machine-functions and -flto are used, so the optimization is silently ignored.  My fix generates linker option -plugin-opt=-split-machine-functions for this case. It allows the linker to pass "split-machine-functions" to code generator to turn on that optimization.  It works for both gold and lld.

Reviewed By: hoy, wenlei

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




More information about the All-commits mailing list