brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.0 KiB · 40b8b00 Raw
146 lines · plain
1; RUN: rm -rf %t && split-file %s %t && cd %t2; RUN: mkdir d3 4;; First ensure that the ThinLTO handling in lld handles5;; bitcode without summary sections gracefully and generates index file.6; RUN: llvm-as 1.ll -o 1.o7; RUN: llvm-as %p/Inputs/thinlto.ll -o d/2.o8; RUN: wasm-ld --thinlto-index-only -shared 1.o d/2.o -o 39; RUN: ls d/2.o.thinlto.bc10; RUN: not test -e 311; RUN: wasm-ld -shared 1.o d/2.o -o 312; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM13 14;; Basic ThinLTO tests.15; RUN: llvm-as 0.ll -o 0.o16; RUN: opt -module-summary 1.ll -o 1.o17; RUN: opt -module-summary %p/Inputs/thinlto.ll -o d/2.o18; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o 3.o19; RUN: cp 3.o 4.o20 21;; Ensure lld doesn't generates index files when --thinlto-index-only is not enabled.22; RUN: rm -f 1.o.thinlto.bc d/2.o.thinlto.bc23; RUN: wasm-ld -shared 1.o d/2.o -o /dev/null24; RUN: not ls 1.o.thinlto.bc25; RUN: not ls d/2.o.thinlto.bc26 27;; Ensure lld generates an index and not a binary if requested.28; RUN: wasm-ld --thinlto-index-only -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 429; RUN: not test -e 430; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND131; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND232; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND333; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND434 35; RUN: rm -f 1.o.thinlto.bc d/2.o.thinlto.bc 3.o.thinlto.bc 4.o.thinlto.bc36; RUN: wasm-ld --thinlto-index-only=4.txt --thinlto-emit-imports-files -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 437; RUN: not test -e 438; RUN: FileCheck %s --check-prefix=RSP --implicit-check-not={{.}} < 4.txt39; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND140; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND241; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND342; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND443; RUN: FileCheck %s --check-prefix=IMPORTS1 --implicit-check-not={{.}} < 1.o.imports44; RUN: count 0 < d/2.o.imports45;; Test that LLD generates an empty index even for lazy object file that is not added to link.46; RUN: count 0 < 3.o.imports47; RUN: count 0 < 4.o.imports48 49;; Test interaction with --save-temps.50; RUN: rm -f 4.txt 1.o.thinlto.bc d/2.o.thinlto.bc 3.o.thinlto.bc 4.o.thinlto.bc51; RUN: wasm-ld --thinlto-index-only=4.txt --thinlto-emit-imports-files --save-temps -shared 0.o 1.o --start-lib d/2.o 3.o --end-lib 4.o -o t52; RUN: not test -e 453; RUN: FileCheck %s --check-prefix=RSP --implicit-check-not={{.}} < 4.txt54; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND155; RUN: FileCheck %s --check-prefix=IMPORTS1 --implicit-check-not={{.}} < 1.o.imports56; RUN: FileCheck %s --check-prefix=RESOLUTION < t.resolution.txt57; RUN: llvm-dis < t.index.bc | FileCheck %s --check-prefix=INDEX-BC58 59; RSP:      1.o60; RSP-NEXT: d/2.o61; RSP-NEXT: 4.o62 63; IMPORTS1: d/2.o64 65; RESOLUTION:      0.o66; RESOLUTION-NEXT: -r=0.o,foo,px67; RESOLUTION-NEXT: 1.o68 69; INDEX-BC:      ^0 = module: (path: "1.o", hash: (0, 0, 0, 0, 0))70; INDEX-BC-NEXT: ^1 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))71; INDEX-BC-NEXT: ^2 = module: (path: "d/2.o", hash: (0, 0, 0, 0, 0))72 73;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy.74; RUN: rm -f 1.o.thinlto.bc75; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown /dev/null -o dummy.o76; RUN: wasm-ld --thinlto-index-only -shared dummy.o --start-lib 1.o --end-lib -o /dev/null77; RUN: ls 1.o.thinlto.bc78 79;; Ensure when the same bitcode object is given as both lazy and non-lazy,80;; LLD does not generate an empty index for the lazy object.81; RUN: rm -f d/2.o.thinlto.bc82; RUN: wasm-ld --thinlto-index-only -shared 1.o d/2.o --start-lib d/2.o --end-lib -o /dev/null83; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'84; RUN: rm -f d/2.o.thinlto.bc85; RUN: wasm-ld --thinlto-index-only -shared --start-lib d/2.o --end-lib d/2.o 1.o -o /dev/null86; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'87 88;; Ensure when the same lazy bitcode object is given multiple times,89;; no empty index file is generated if one of the copies is linked.90; RUN: rm -f d/2.o.thinlto.bc91; RUN: wasm-ld --thinlto-index-only -shared 1.o --start-lib d/2.o --end-lib --start-lib d/2.o --end-lib -o /dev/null92; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'93 94; NM: T f95 96;; The backend index for this module contains summaries from itself and97;; Inputs/thinlto.ll, as it imports from the latter.98; BACKEND1: <MODULE_STRTAB_BLOCK99; BACKEND1-NEXT: <ENTRY {{.*}} record string = '1.o'100; BACKEND1-NEXT: <ENTRY {{.*}} record string = 'd/2.o'101; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK102; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK103; BACKEND1: <VERSION104; BACKEND1: <FLAGS105; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}106; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}107; BACKEND1: <COMBINED108; BACKEND1: <COMBINED109; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK110 111;; The backend index for Input/thinlto.ll contains summaries from itself only,112;; as it does not import anything.113; BACKEND2: <MODULE_STRTAB_BLOCK114; BACKEND2-NEXT: <ENTRY {{.*}} record string = 'd/2.o'115; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK116; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK117; BACKEND2-NEXT: <VERSION118; BACKEND2-NEXT: <FLAGS119; BACKEND2-NEXT: <VALUE_GUID {{.*}} op0=1 op1=3060885059 op2=1207956914120; BACKEND2-NEXT: <COMBINED121; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK122 123; BACKEND3: ^0 = flags:124 125; BACKEND4: ^0 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))126 127;--- 0.ll128target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"129target triple = "wasm32-unknown-unknown"130 131define void @foo() {132  ret void133}134 135;--- 1.ll136target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"137target triple = "wasm32-unknown-unknown"138 139declare void @g(...)140 141define void @f() {142entry:143  call void (...) @g()144  ret void145}146