161fc10d6SMircea Trofin; REQUIRES: x86-registered-target
261fc10d6SMircea Trofin
361fc10d6SMircea Trofin; check the -lto-embed-bitcode=post-thinlto-merge does not perform optimizations
461fc10d6SMircea Trofin; we expect 't1' - i.e start-lib1.ll's products - have both foo and bar defined,
561fc10d6SMircea Trofin; but the bar call is still made from foo.
661fc10d6SMircea Trofin; RUN: opt -module-summary %p/Inputs/start-lib1.ll -o %t1.bc
761fc10d6SMircea Trofin; RUN: opt -module-summary %p/Inputs/start-lib2.ll -o %t2.bc
861fc10d6SMircea Trofin; RUN: llvm-lto -thinlto -o %t.o %t1.bc %t2.bc
961fc10d6SMircea Trofin
1061fc10d6SMircea Trofin; 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
1161fc10d6SMircea Trofin; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-CMD
1261fc10d6SMircea Trofin; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
1361fc10d6SMircea Trofin; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
1461fc10d6SMircea Trofin
1561fc10d6SMircea Trofin; For the optimized case, we expect the inlining of foo into bar to happen.
1661fc10d6SMircea Trofin; 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=optimized
1761fc10d6SMircea Trofin; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-NO-CMD
1861fc10d6SMircea Trofin; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
1961fc10d6SMircea Trofin; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-OPT
2061fc10d6SMircea Trofin
2161fc10d6SMircea Trofin; CHECK-ELF:      .text   PROGBITS 0000000000000000 [[#%x,OFF:]] [[#%x,SIZE:]] 00 AX 0
2261fc10d6SMircea Trofin; CHECK-ELF-NEXT: .llvmbc PROGBITS 0000000000000000 [[#%x,OFF:]] [[#%x,SIZE:]] 00    0
2361fc10d6SMircea Trofin; CHECK-ELF-CMD:  .llvmcmd
2461fc10d6SMircea Trofin; CHECK-ELF-NO-CMD-NOT: .llvmcmd
2561fc10d6SMircea Trofin
2661fc10d6SMircea Trofin; CHECK:          define void @foo()
2761fc10d6SMircea Trofin; CHECK-OPT-NEXT:   ret void
2861fc10d6SMircea Trofin; CHECK-NOOPT-NEXT: call void @bar()
29*8ea7ef8eSMircea Trofin; CHECK-NOOPT: define available_externally void @bar()
3061fc10d6SMircea Trofin; CHECK-NOOPT-NEXT: ret void
31