This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG735ab4be3569: [ThinLTO] Fix .llvmcmd emission (authored by mtrofin).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90278/new/ https://reviews.llvm.org/D90278 Files: clang/test/CodeGen/thinlto_embed_bitcode.ll llvm/include/llvm/Bitcode/BitcodeWriter.h llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/LTO/LTOBackend.cpp Index: llvm/lib/LTO/LTOBackend.cpp =================================================================== --- llvm/lib/LTO/LTOBackend.cpp +++ llvm/lib/LTO/LTOBackend.cpp @@ -373,8 +373,7 @@ dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but " "command line arguments are not available"); llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(), - /*EmbedBitcode*/ true, - /*EmbedMarker*/ false, + /*EmbedBitcode*/ true, /*EmbedCmdline*/ true, /*Cmdline*/ CmdArgs); } // FIXME: Plumb the combined index into the new pass manager. @@ -398,7 +397,7 @@ if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized) llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(), /*EmbedBitcode*/ true, - /*EmbedMarker*/ false, + /*EmbedCmdline*/ false, /*CmdArgs*/ std::vector<uint8_t>()); std::unique_ptr<ToolOutputFile> DwoOut; Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4834,7 +4834,7 @@ } void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf, - bool EmbedBitcode, bool EmbedMarker, + bool EmbedBitcode, bool EmbedCmdline, const std::vector<uint8_t> &CmdArgs) { // Save llvm.compiler.used and remove it. SmallVector<Constant *, 2> UsedArray; @@ -4892,7 +4892,7 @@ } // Skip if only bitcode needs to be embedded. - if (EmbedMarker) { + if (EmbedCmdline) { // Embed command-line options. ArrayRef<uint8_t> CmdData(const_cast<uint8_t *>(CmdArgs.data()), CmdArgs.size()); Index: llvm/include/llvm/Bitcode/BitcodeWriter.h =================================================================== --- llvm/include/llvm/Bitcode/BitcodeWriter.h +++ llvm/include/llvm/Bitcode/BitcodeWriter.h @@ -158,11 +158,11 @@ /// pass an empty (default-initialized) MemoryBufferRef, and the serialization /// will be handled by this API. The same behavior happens if the provided Buf /// is not bitcode (i.e. if it's invalid data or even textual LLVM assembly). - /// If EmbedMarker is set, the command line is also exported in + /// If EmbedCmdline is set, the command line is also exported in /// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs /// were empty. void EmbedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode, - bool EmbedMarker, + bool EmbedCmdline, const std::vector<uint8_t> &CmdArgs); } // end namespace llvm Index: clang/test/CodeGen/thinlto_embed_bitcode.ll =================================================================== --- clang/test/CodeGen/thinlto_embed_bitcode.ll +++ clang/test/CodeGen/thinlto_embed_bitcode.ll @@ -9,14 +9,14 @@ ; For the optimized case, we expect the inlining of foo into bar to happen. ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-opt.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=optimized -; RUN: llvm-readelf -S %t-opt.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-NO-CMD +; RUN: llvm-readelf -S %t-opt.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-NO-CMD ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t-opt.o /dev/null ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-OPT ; For the post-merge case, perform the embedded bitcode extraction, then ; round-trip through compilation and ensure the objects are the same. ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt -; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-CMD +; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT ; We should only need the index and the post-thinlto merged module to generate
Index: llvm/lib/LTO/LTOBackend.cpp =================================================================== --- llvm/lib/LTO/LTOBackend.cpp +++ llvm/lib/LTO/LTOBackend.cpp @@ -373,8 +373,7 @@ dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but " "command line arguments are not available"); llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(), - /*EmbedBitcode*/ true, - /*EmbedMarker*/ false, + /*EmbedBitcode*/ true, /*EmbedCmdline*/ true, /*Cmdline*/ CmdArgs); } // FIXME: Plumb the combined index into the new pass manager. @@ -398,7 +397,7 @@ if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized) llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(), /*EmbedBitcode*/ true, - /*EmbedMarker*/ false, + /*EmbedCmdline*/ false, /*CmdArgs*/ std::vector<uint8_t>()); std::unique_ptr<ToolOutputFile> DwoOut; Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4834,7 +4834,7 @@ } void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf, - bool EmbedBitcode, bool EmbedMarker, + bool EmbedBitcode, bool EmbedCmdline, const std::vector<uint8_t> &CmdArgs) { // Save llvm.compiler.used and remove it. SmallVector<Constant *, 2> UsedArray; @@ -4892,7 +4892,7 @@ } // Skip if only bitcode needs to be embedded. - if (EmbedMarker) { + if (EmbedCmdline) { // Embed command-line options. ArrayRef<uint8_t> CmdData(const_cast<uint8_t *>(CmdArgs.data()), CmdArgs.size()); Index: llvm/include/llvm/Bitcode/BitcodeWriter.h =================================================================== --- llvm/include/llvm/Bitcode/BitcodeWriter.h +++ llvm/include/llvm/Bitcode/BitcodeWriter.h @@ -158,11 +158,11 @@ /// pass an empty (default-initialized) MemoryBufferRef, and the serialization /// will be handled by this API. The same behavior happens if the provided Buf /// is not bitcode (i.e. if it's invalid data or even textual LLVM assembly). - /// If EmbedMarker is set, the command line is also exported in + /// If EmbedCmdline is set, the command line is also exported in /// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs /// were empty. void EmbedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode, - bool EmbedMarker, + bool EmbedCmdline, const std::vector<uint8_t> &CmdArgs); } // end namespace llvm Index: clang/test/CodeGen/thinlto_embed_bitcode.ll =================================================================== --- clang/test/CodeGen/thinlto_embed_bitcode.ll +++ clang/test/CodeGen/thinlto_embed_bitcode.ll @@ -9,14 +9,14 @@ ; For the optimized case, we expect the inlining of foo into bar to happen. ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-opt.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=optimized -; RUN: llvm-readelf -S %t-opt.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-NO-CMD +; RUN: llvm-readelf -S %t-opt.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-NO-CMD ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t-opt.o /dev/null ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-OPT ; For the post-merge case, perform the embedded bitcode extraction, then ; round-trip through compilation and ensure the objects are the same. ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt -; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-CMD +; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT ; We should only need the index and the post-thinlto merged module to generate
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits