37 lines · plain
1; Test to ensure that building summary with -force-summary-edges-cold2; blocks importing as expected.3 4; "-stats" and "-debug-only" require +Asserts.5; REQUIRES: asserts6 7; First do with default options, which should import8; RUN: opt -module-summary %s -o %t.bc9; RUN: opt -module-summary %p/Inputs/funcimport_forcecold.ll -o %t2.bc10; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc11; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT12 13; Next rebuild caller module summary with non-critical edges forced cold (which14; should affect all edges in this test as we don't have any sample pgo).15; Make sure we don't import.16; RUN: opt -force-summary-edges-cold=all-non-critical -module-summary %s -o %t.bc17; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc18; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT19 20; Next rebuild caller module summary with all edges forced cold.21; Make sure we don't import.22; RUN: opt -force-summary-edges-cold=all -module-summary %s -o %t.bc23; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc24; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT25 26define i32 @main() {27entry:28 call void @foo()29 ret i32 030}31 32; IMPORT: Import foo33; NOIMPORT-NOT: Import foo34; IMPORT: define available_externally void @foo()35; NOIMPORT: declare void @foo()36declare void @foo()37