[all-commits] [llvm/llvm-project] c6cf32: [CodeGen] Implement post-opt linking option for bu...

Jacob Lambert via All-commits all-commits at lists.llvm.org
Wed Nov 8 10:54:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c6cf32950283f729dfe9a9b2626443d05e2cb1b1
      https://github.com/llvm/llvm-project/commit/c6cf32950283f729dfe9a9b2626443d05e2cb1b1
  Author: Jacob Lambert <jacob.lambert at amd.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M clang/include/clang/CodeGen/BackendUtil.h
    A clang/lib/CodeGen/BackendConsumer.h
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CMakeLists.txt
    M clang/lib/CodeGen/CodeGenAction.cpp
    A clang/lib/CodeGen/LinkInModulesPass.cpp
    A clang/lib/CodeGen/LinkInModulesPass.h

  Log Message:
  -----------
  [CodeGen] Implement post-opt linking option for builtin bitocdes (#69371)

In this patch, we create a new ModulePass that mimics the LinkInModules
API from CodeGenAction.cpp, and a new command line option to enable the
pass. As part of the implementation, we needed to refactor the
BackendConsumer class definition into a new separate header (instead of
embedded in CodeGenAction.cpp). With this new pass, we can now re-link
bitcodes supplied via the -mlink-built-in bitcodes as part of the
RunOptimizationPipeline.

With the re-linking pass, we now handle cases where new device library
functions are introduced as part of the optimization pipeline.
Previously, these newly introduced functions (for example a fused sincos
call) would result in a linking error due to a missing function
definition. This new pass can be initiated via:

      -mllvm -relink-builtin-bitcode-postop

Also note we intentionally exclude bitcodes supplied via the
-mlink-bitcode-file option from the second linking step




More information about the All-commits mailing list