Skip to content

Commit 3723868

Browse files
committed
[OpenMP] Fix file arguments for embedding bitcode in the linker wrapper
Summary: The linker wrapper supports embedding bitcode images instead of linked device images to facilitate JIT in the device runtime. However, we were incorrectly passing in the file twice when this option was set. This patch makes sure we only use the intermediate result of the LTO pass and don't add the final output to the full job. In the future we will want to add both of these andle handle that accoridngly to allow the runtime to either use the AoT compiled version or JIT compile the bitcode version if availible.
1 parent 9ba9371 commit 3723868

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,14 @@ Error linkBitcodeFiles(SmallVectorImpl<std::string> &InputFiles,
10121012
if (Error Err = LTOBackend->run(AddStream))
10131013
return Err;
10141014

1015+
// If we are embedding bitcode we only need the intermediate output.
1016+
if (EmbedBitcode) {
1017+
InputFiles = NewInputFiles;
1018+
return Error::success();
1019+
}
1020+
10151021
// Is we are compiling for NVPTX we need to run the assembler first.
1016-
if (TheTriple.isNVPTX() && !EmbedBitcode) {
1022+
if (TheTriple.isNVPTX()) {
10171023
for (auto &File : Files) {
10181024
auto FileOrErr = nvptx::assemble(File, TheTriple, Arch, !WholeProgram);
10191025
if (!FileOrErr)

0 commit comments

Comments
 (0)