summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/thinlto_embed_bitcode.ll
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2020-10-28 20:16:51 -0700
committerMircea Trofin <mtrofin@google.com>2020-10-29 09:57:42 -0700
commit13aee94bc710bfa6277c1f07146c714ee65bf2de (patch)
treef352f8c4fbd7721388fd9e6cf52755ae536d863f /clang/test/CodeGen/thinlto_embed_bitcode.ll
parentec7780ebdab480139596c3cb08ee77d7035457b3 (diff)
[ThinLTO] Fix empty .llvmcmd sections
When passing -lto-embed-bitcode=post-merge-pre-opt, we were getting empty .llvmcmd sections. It turns out that is because the CodeGenOptions::CmdArgs field was only populated when clang saw -fembed-bitcode={all|marker}. This patch always populates the CodeGenOptions::CmdArgs. The overhead of carrying through in memory in all cases is likely negligible in the grand schema of things, and it keeps the using code simple. Differential Revision: https://reviews.llvm.org/D90366
Diffstat (limited to 'clang/test/CodeGen/thinlto_embed_bitcode.ll')
-rw-r--r--clang/test/CodeGen/thinlto_embed_bitcode.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CodeGen/thinlto_embed_bitcode.ll b/clang/test/CodeGen/thinlto_embed_bitcode.ll
index 5f7b9f632af3..6c7e36e7226b 100644
--- a/clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ b/clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
; 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-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
; 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
; the exact same .o as we originally did.
; RUN: rm %t1.bc %t2.bc
; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir %t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+;
+; The resulting .o is almost the same, but the .llvmcmd section would be
+; different because of the extra -thinlto-assume-merged.
+; A simple, meaningful comparison is to just compare the stripped objects.
+; RUN: llvm-strip --strip-all %t-redo.o
+; RUN: llvm-strip --strip-all %t.o
; RUN: diff %t-redo.o %t.o
; CHECK-ELF: .text PROGBITS 0000000000000000 [[#%x,OFF:]] [[#%x,SIZE:]] 00 AX 0