1cee313d2SEric Christopher; Test to ensure that building summary with -force-summary-edges-cold 2cee313d2SEric Christopher; blocks importing as expected. 3cee313d2SEric Christopher 4cee313d2SEric Christopher; "-stats" and "-debug-only" require +Asserts. 5cee313d2SEric Christopher; REQUIRES: asserts 6cee313d2SEric Christopher 7cee313d2SEric Christopher; First do with default options, which should import 8cee313d2SEric Christopher; RUN: opt -module-summary %s -o %t.bc 9cee313d2SEric Christopher; RUN: opt -module-summary %p/Inputs/funcimport_forcecold.ll -o %t2.bc 10cee313d2SEric Christopher; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc 11*a9af1b9aSFangrui Song; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT 12cee313d2SEric Christopher 13cee313d2SEric Christopher; Next rebuild caller module summary with non-critical edges forced cold (which 14cee313d2SEric Christopher; should affect all edges in this test as we don't have any sample pgo). 15cee313d2SEric Christopher; Make sure we don't import. 16cee313d2SEric Christopher; RUN: opt -force-summary-edges-cold=all-non-critical -module-summary %s -o %t.bc 17cee313d2SEric Christopher; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc 18*a9af1b9aSFangrui Song; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT 19cee313d2SEric Christopher 20cee313d2SEric Christopher; Next rebuild caller module summary with all edges forced cold. 21cee313d2SEric Christopher; Make sure we don't import. 22cee313d2SEric Christopher; RUN: opt -force-summary-edges-cold=all -module-summary %s -o %t.bc 23cee313d2SEric Christopher; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc 24*a9af1b9aSFangrui Song; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT 25cee313d2SEric Christopher 26cee313d2SEric Christopherdefine i32 @main() { 27cee313d2SEric Christopherentry: 28cee313d2SEric Christopher call void @foo() 29cee313d2SEric Christopher ret i32 0 30cee313d2SEric Christopher} 31cee313d2SEric Christopher 32cee313d2SEric Christopher; IMPORT: Import foo 33cee313d2SEric Christopher; NOIMPORT-NOT: Import foo 34cee313d2SEric Christopher; IMPORT: define available_externally void @foo() 35cee313d2SEric Christopher; NOIMPORT: declare void @foo() 36cee313d2SEric Christopherdeclare void @foo() 37