brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.8 KiB · fb21834 Raw
155 lines · plain
1; First ensure that the ThinLTO handling in the gold plugin handles2; bitcode without summary sections gracefully.3; RUN: llvm-as %s -o %t.o4; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o5; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \6; RUN:    -m elf_x86_64 \7; RUN:    --plugin-opt=thinlto \8; RUN:    --plugin-opt=thinlto-index-only \9; RUN:    -shared %t.o %t2.o -o %t310; RUN: not test -e %t311; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \12; RUN:    -m elf_x86_64 \13; RUN:    --plugin-opt=thinlto \14; RUN:    -shared %t.o %t2.o -o %t415; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM16 17; Next generate summary sections and test gold handling.18; RUN: opt -module-summary %s -o %t.o19; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o20 21; Ensure gold generates an index and not a binary if requested.22; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \23; RUN:    -m elf_x86_64 \24; RUN:    --plugin-opt=thinlto \25; RUN:    --plugin-opt=thinlto-index-only \26; RUN:    -shared %t.o %t2.o -o %t327; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND128; RUN: llvm-bcanalyzer -dump %t2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND229; RUN: llvm-dis %t.o.thinlto.bc -o - | FileCheck %s --check-prefix=DIS130; RUN: llvm-dis %t2.o.thinlto.bc -o - | FileCheck %s --check-prefix=DIS231; RUN: not test -e %t332 33; Ensure gold generates an index as well as a binary with save-temps in ThinLTO mode.34; First force single-threaded mode35; RUN: rm -f %t4*36; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \37; RUN:    -m elf_x86_64 \38; RUN:    --plugin-opt=save-temps \39; RUN:    --plugin-opt=thinlto \40; RUN:    --plugin-opt=jobs=1 \41; RUN:    -shared %t.o %t2.o -o %t442; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED43; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM44; Ensure ld does not emit empty combined module in default.45; RUN: ls %t4.lto.o* | count 246 47; Check with --no-map-whole-files48; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \49; RUN:    -m elf_x86_64 \50; RUN:    --plugin-opt=save-temps \51; RUN:    --plugin-opt=thinlto \52; RUN:    --plugin-opt=jobs=1 \53; RUN:    --no-map-whole-files \54; RUN:    -shared %t.o %t2.o -o %t455; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED56; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM57 58; Next force multi-threaded mode59; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \60; RUN:    -m elf_x86_64 \61; RUN:    --plugin-opt=save-temps \62; RUN:    --plugin-opt=thinlto \63; RUN:    --plugin-opt=jobs=2 \64; RUN:    -shared %t.o %t2.o -o %t465; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED66; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM67 68; Test --plugin-opt=obj-path to ensure unique object files generated.69; RUN: rm -f %t5.o %t5.o170; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \71; RUN:    -m elf_x86_64 \72; RUN:    --plugin-opt=thinlto \73; RUN:    --plugin-opt=jobs=2 \74; RUN:    --plugin-opt=obj-path=%t5.o \75; RUN:    -shared %t.o %t2.o -o %t476; RUN: llvm-nm %t5.o1 | FileCheck %s --check-prefix=NM277; RUN: llvm-nm %t5.o2 | FileCheck %s --check-prefix=NM278; Ensure ld emits empty combined module if specific obj-path.79; RUN: ls %t5.o* | count 380 81; Test to ensure that thinlto-index-only with obj-path creates the file.82; RUN: rm -f %t5.o %t5.o183; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \84; RUN:    -m elf_x86_64 \85; RUN:    --plugin-opt=thinlto \86; RUN:    --plugin-opt=jobs=2 \87; RUN:    --plugin-opt=thinlto-index-only \88; RUN:    --plugin-opt=obj-path=%t5.o \89; RUN:    -shared %t.o %t2.o -o %t490; RUN: llvm-readobj -h %t5.o | FileCheck %s --check-prefix=FORMAT91; RUN: llvm-nm %t5.o 2>&1 | count 092 93; NM: T f94; NM2: T {{f|g}}95; FORMAT: Format: elf64-x86-6496 97; The backend index for this module contains summaries from itself and98; Inputs/thinlto.ll, as it imports from the latter.99; BACKEND1: <MODULE_STRTAB_BLOCK100; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'101; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'102; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK103; BACKEND1-NEXT: <GLOBALVAL_SUMMARY_BLOCK104; BACKEND1-NEXT: <VERSION105; BACKEND1-NEXT: <FLAGS106; BACKEND1-NEXT: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}107; BACKEND1-NEXT: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}108; BACKEND1-NEXT: <COMBINED109; BACKEND1-NEXT: <COMBINED110; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK111 112; The backend index for Input/thinlto.ll contains summaries from itself only,113; as it does not import anything.114; BACKEND2: <MODULE_STRTAB_BLOCK115; BACKEND2-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp2.o'116; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK117; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK118; BACKEND2-NEXT: <VERSION119; BACKEND2-NEXT: <FLAGS120; BACKEND2-NEXT: <VALUE_GUID {{.*}} op0=1 op1=3060885059 op2=1207956914121; BACKEND2-NEXT: <COMBINED122; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK123 124; DIS1: ^0 = module: (path: "{{.*}}thinlto.ll.tmp.o", hash: (0, 0, 0, 0, 0))125; DIS1: ^1 = module: (path: "{{.*}}thinlto.ll.tmp2.o", hash: (0, 0, 0, 0, 0))126; DIS1: ^2 = gv: (guid: 13146401226427987378, summaries: (function: (module: ^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 1)))127; DIS1: ^3 = gv: (guid: 14740650423002898831, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 2, calls: ((callee: ^2)))))128 129; DIS2: ^0 = module: (path: "{{.*}}thinlto.ll.tmp2.o", hash: (0, 0, 0, 0, 0))130; DIS2: ^1 = gv: (guid: 13146401226427987378, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 1)))131 132; COMBINED: <MODULE_STRTAB_BLOCK133; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'134; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'135; COMBINED-NEXT: </MODULE_STRTAB_BLOCK136; COMBINED-NEXT: <GLOBALVAL_SUMMARY_BLOCK137; COMBINED-NEXT: <VERSION138; COMBINED-NEXT: <FLAGS139; COMBINED-NEXT: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}140; COMBINED-NEXT: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}141; COMBINED-NEXT: <COMBINED142; COMBINED-NEXT: <COMBINED143; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK144 145target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"146target triple = "x86_64-unknown-linux-gnu"147 148declare void @g(...)149 150define void @f() {151entry:152  call void (...) @g()153  ret void154}155