[PATCH] D152391: [Clang] Allow bitcode linking when the input is LLVM-IR

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 11:16:45 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: tra, yaxunl, jdoerfert, tianshilei1992, MaskRay, JonChesterfield, phosek.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang provides the `-mlink-bitcode-file` and `-mlink-builtin-bitcode`
options to insert LLVM-IR into the current TU. These are usefuly
primarily for including LLVM-IR files that require special handling to
be correct and cannot be linked normally, such as GPU vendor libraries
like `libdevice.10.bc`. Currently these options can only be used if the
source input goes through the AST consumer path. This patch makes the
changes necessary to also support this when the input is LLVM-IR. This
will allow the following operation:

  clang in.bc -Xclang -mlink-builtin-bitcode -Xclang libdevice.10.bc


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152391

Files:
  clang/include/clang/CodeGen/CodeGenAction.h
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/test/CodeGen/link-bitcode-file.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152391.529379.patch
Type: text/x-patch
Size: 6068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230607/f38d7afd/attachment.bin>


More information about the cfe-commits mailing list