brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 4844e71 Raw
120 lines · plain
1; REQUIRES: x862; RUN: rm -rf %t; split-file %s %t3 4;; First ensure that the ThinLTO handling in lld handles5;; bitcode without summary sections gracefully and generates index file.6; RUN: llvm-as %t/f.ll -o %t/1.o7; RUN: llvm-as %t/g.ll -o %t/2.o8; RUN: %lld --thinlto-index-only -dylib %t/1.o %t/2.o -o %t/39; RUN: ls %t/2.o.thinlto.bc10; RUN: not test -e %t/311; RUN: %lld -dylib %t/1.o %t/2.o -o %t/312; RUN: llvm-nm %t/3 | FileCheck %s --check-prefix=NM13 14;; Basic ThinLTO tests.15; RUN: opt -module-summary %t/f.ll -o %t/1.o16; RUN: opt -module-summary %t/g.ll -o %t/2.o17; RUN: opt -module-summary %t/empty.ll -o %t/3.o18 19;; Ensure lld doesn't generates index files when thinlto-index-only is not enabled.20; RUN: rm -f %t/1.o.thinlto.bc %t/2.o.thinlto.bc %t/3.o.thinlto.bc21; RUN: %lld -dylib %t/1.o %t/2.o %t/3.o -o %t/522; RUN: not ls %t/1.o.thinlto.bc23; RUN: not ls %t/2.o.thinlto.bc24; RUN: not ls %t/3.o.thinlto.bc25 26;; Ensure lld generates an index and not a binary if requested.27; RUN: %lld --thinlto-index-only -dylib %t/1.o %t/2.o -o %t/428; RUN: llvm-bcanalyzer -dump %t/1.o.thinlto.bc | FileCheck %s -DP1=%t/1.o -DP2=%t/2.o --check-prefix=BACKEND129; RUN: llvm-bcanalyzer -dump %t/2.o.thinlto.bc | FileCheck %s -DP2=%t/2.o --check-prefix=BACKEND230; RUN: not test -e %t/431 32;; Ensure lld generates an index even if the file is wrapped in --start-lib/--end-lib.33; RUN: rm -f %t/2.o.thinlto.bc %t/434; RUN: %lld --thinlto-index-only -dylib %t/1.o %t/3.o --start-lib %t/2.o --end-lib -o %t/435; RUN: llvm-dis < %t/2.o.thinlto.bc | grep -q '\^0 = module:'36; RUN: not test -e %t/437 38;; Test that LLD generates an empty index even for lazy object file that is not added to link.39;; Test LLD generates empty imports file either because of thinlto-emit-imports-files option.40; RUN: rm -f %t/1.o.thinlto.bc %t/1.o.imports41; RUN: %lld --thinlto-index-only -dylib %t/2.o --start-lib %t/1.o --end-lib \42; RUN:      --thinlto-emit-imports-files -o %t/343; RUN: ls %t/1.o.thinlto.bc44; RUN: ls %t/1.o.imports45 46;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy.47; RUN: rm -f %t/dummy.o %t/1.o.thinlto.bc48; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin /dev/null -o %t/dummy.o49; RUN: %lld --thinlto-index-only -dylib %t/dummy.o --start-lib %t/1.o --end-lib -o /dev/null50; RUN: ls %t/1.o.thinlto.bc51 52;; Ensure when the same bitcode object is given as both lazy and non-lazy,53;; LLD does not generate an empty index for the lazy object.54; RUN: rm -f %t/2.o.thinlto.bc55; RUN: %lld --thinlto-index-only -dylib %t/1.o %t/2.o --start-lib %t/2.o --end-lib -o /dev/null56; RUN: llvm-dis < %t/2.o.thinlto.bc | grep -q '\^0 = module:'57; RUN: rm -f %t/2.o.thinlto.bc58; RUN: %lld --thinlto-index-only -dylib --start-lib %t/2.o --end-lib %t/2.o %t/1.o -o /dev/null59; RUN: llvm-dis < %t/2.o.thinlto.bc | grep -q '\^0 = module:'60 61;; Ensure when the same lazy bitcode object is given multiple times,62;; no empty index file is generated if one of the copies is linked.63; RUN: rm -f %t/2.o.thinlto.bc64; RUN: %lld --thinlto-index-only -dylib %t/1.o --start-lib %t/2.o --end-lib --start-lib %t/2.o --end-lib -o /dev/null65; RUN: llvm-dis < %t/2.o.thinlto.bc | grep -q '\^0 = module:'66 67; NM: T _f68 69;; The backend index for this module contains summaries from itself and70;; g.ll, as it imports from the latter.71; BACKEND1: <MODULE_STRTAB_BLOCK72; BACKEND1-NEXT: <ENTRY {{.*}} record string = '[[P1]]'73; BACKEND1-NEXT: <ENTRY {{.*}} record string = '[[P2]]'74; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK75; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK76; BACKEND1: <VERSION77; BACKEND1: <FLAGS78; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}79; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}80; BACKEND1: <COMBINED81; BACKEND1: <COMBINED82; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK83 84;; The backend index for g.ll contains summaries from itself only,85;; as it does not import anything.86; BACKEND2: <MODULE_STRTAB_BLOCK87; BACKEND2-NEXT: <ENTRY {{.*}} record string = '[[P2]]'88; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK89; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK90; BACKEND2-NEXT: <VERSION91; BACKEND2-NEXT: <FLAGS92; BACKEND2-NEXT: <VALUE_GUID {{.*}} op0=1 op1=3060885059 op2=120795691493; BACKEND2-NEXT: <COMBINED94; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK95 96;--- f.ll97target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"98target triple = "x86_64-apple-darwin"99 100declare void @g(...)101 102define void @f() {103entry:104  call void (...) @g()105  ret void106}107 108;--- g.ll109target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"110target triple = "x86_64-apple-darwin"111 112define void @g() {113entry:114  ret void115}116 117;--- empty.ll118target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"119target triple = "x86_64-apple-darwin"120