brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · da60af8 Raw
147 lines · plain
1; REQUIRES: x862; RUN: rm -rf %t && split-file %s %t && cd %t3; RUN: mkdir d4 5;; First ensure that the ThinLTO handling in lld handles6;; bitcode without summary sections gracefully and generates index file.7; RUN: llvm-as 1.ll -o 1.o8; RUN: llvm-as %p/Inputs/thinlto.ll -o d/2.o9; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o d/2.o -o 310; RUN: ls d/2.o.thinlto.bc11; RUN: not test -e 312; RUN: ld.lld -shared 1.o d/2.o -o 313; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM14 15;; Basic ThinLTO tests.16; RUN: llvm-as 0.ll -o 0.o17; RUN: opt -module-summary 1.ll -o 1.o18; RUN: opt -module-summary %p/Inputs/thinlto.ll -o d/2.o19; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o 3.o20; RUN: cp 3.o 4.o21 22;; Ensure lld doesn't generates index files when --thinlto-index-only is not enabled.23; RUN: rm -f 1.o.thinlto.bc d/2.o.thinlto.bc24; RUN: ld.lld -shared 1.o d/2.o -o /dev/null25; RUN: not ls 1.o.thinlto.bc26; RUN: not ls d/2.o.thinlto.bc27 28;; Ensure lld generates an index and not a binary if requested.29; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 430; RUN: not test -e 431; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND132; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND233; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND334; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND435 36; RUN: rm -f 1.o.thinlto.bc d/2.o.thinlto.bc 3.o.thinlto.bc 4.o.thinlto.bc37; RUN: ld.lld --plugin-opt=thinlto-index-only=4.txt --plugin-opt=thinlto-emit-imports-files -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 438; RUN: not test -e 439; RUN: FileCheck %s --check-prefix=RSP --implicit-check-not={{.}} < 4.txt40; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND141; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND242; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND343; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND444; RUN: FileCheck %s --check-prefix=IMPORTS1 --implicit-check-not={{.}} < 1.o.imports45; RUN: count 0 < d/2.o.imports46;; Test that LLD generates an empty index even for lazy object file that is not added to link.47; RUN: count 0 < 3.o.imports48; RUN: count 0 < 4.o.imports49 50;; Test the other spelling --thinlto-index-only= --thinlto-emit-imports-files and the interaction with --save-temps.51; RUN: rm -f 4.txt 1.o.thinlto.bc d/2.o.thinlto.bc 3.o.thinlto.bc 4.o.thinlto.bc52; RUN: ld.lld --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 t53; RUN: not test -e 454; RUN: FileCheck %s --check-prefix=RSP --implicit-check-not={{.}} < 4.txt55; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND156; RUN: FileCheck %s --check-prefix=IMPORTS1 --implicit-check-not={{.}} < 1.o.imports57; RUN: FileCheck %s --check-prefix=RESOLUTION < t.resolution.txt58; RUN: llvm-dis < t.index.bc | FileCheck %s --check-prefix=INDEX-BC59 60; RSP:      1.o61; RSP-NEXT: d/2.o62; RSP-NEXT: 4.o63 64; IMPORTS1: d/2.o65 66; RESOLUTION:      0.o67; RESOLUTION-NEXT: -r=0.o,foo,px68; RESOLUTION-NEXT: 1.o69 70; INDEX-BC:      ^0 = module: (path: "1.o", hash: (0, 0, 0, 0, 0))71; INDEX-BC-NEXT: ^1 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))72; INDEX-BC-NEXT: ^2 = module: (path: "d/2.o", hash: (0, 0, 0, 0, 0))73 74;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy.75; RUN: rm -f 1.o.thinlto.bc76; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu /dev/null -o dummy.o77; RUN: ld.lld --plugin-opt=thinlto-index-only -shared dummy.o --start-lib 1.o --end-lib -o /dev/null78; RUN: ls 1.o.thinlto.bc79 80;; Ensure when the same bitcode object is given as both lazy and non-lazy,81;; LLD does not generate an empty index for the lazy object.82; RUN: rm -f d/2.o.thinlto.bc83; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o d/2.o --start-lib d/2.o --end-lib -o /dev/null84; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'85; RUN: rm -f d/2.o.thinlto.bc86; RUN: ld.lld --plugin-opt=thinlto-index-only -shared --start-lib d/2.o --end-lib d/2.o 1.o -o /dev/null87; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'88 89;; Ensure when the same lazy bitcode object is given multiple times,90;; no empty index file is generated if one of the copies is linked.91; RUN: rm -f d/2.o.thinlto.bc92; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o --start-lib d/2.o --end-lib --start-lib d/2.o --end-lib -o /dev/null93; RUN: llvm-dis < d/2.o.thinlto.bc | grep -q '\^0 = module:'94 95; NM: T f96 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 = '1.o'101; BACKEND1-NEXT: <ENTRY {{.*}} record string = 'd/2.o'102; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK103; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK104; BACKEND1: <VERSION105; BACKEND1: <FLAGS106; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}107; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}108; BACKEND1: <COMBINED109; BACKEND1: <COMBINED110; BACKEND1: </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 = 'd/2.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; BACKEND3: ^0 = flags:125 126; BACKEND4: ^0 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))127 128;--- 0.ll129target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"130target triple = "x86_64-unknown-linux-gnu"131 132define void @foo() {133  ret void134}135 136;--- 1.ll137target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"138target triple = "x86_64-unknown-linux-gnu"139 140declare void @g(...)141 142define void @f() {143entry:144  call void (...) @g()145  ret void146}147