brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 168afd3 Raw
50 lines · plain
1; Test to ensure that thin linking with -import-cutoff stops importing when2; expected.3 4; "-stats" and "-debug-only" require +Asserts.5; REQUIRES: asserts6 7; RUN: opt -module-summary %s -o %t.bc8; RUN: opt -module-summary %p/Inputs/funcimport_cutoff.ll -o %t2.bc9; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc10 11; First do with default options, which should import both foo and bar12; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT13 14; Next try to restrict to 1 import. This should import just foo.15; RUN: opt -import-cutoff=1 -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT116 17; Next try to restrict to 0 imports. This should not import.18; RUN: opt -import-cutoff=0 -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT19 20define i32 @main() {21entry:22  call void @foo()23  call void @bar()24  ret i32 025}26 27declare void @foo()28declare void @bar()29 30; Check -print-imports output31; IMPORT: Import foo32; IMPORT: Import bar33; IMPORT1: Import foo34; IMPORT1-NOT: Import bar35; NOIMPORT-NOT: Import foo36; NOIMPORT-NOT: Import bar37 38; Check -S output39; IMPORT-DAG: define available_externally void @foo()40; IMPORT-DAG: define available_externally void @bar()41; NOIMPORT-DAG: declare void @foo()42; NOIMPORT-DAG: declare void @bar()43; IMPORT1-DAG: define available_externally void @foo()44; IMPORT1-DAG: declare void @bar()45 46; Check -stats output47; IMPORT: 2 function-import - Number of functions imported48; IMPORT1: 1 function-import - Number of functions imported49; NOIMPORT-NOT: function-import - Number of functions imported50