diff options
| author | Teresa Johnson <tejohnson@google.com> | 2018-03-31 00:18:08 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2018-03-31 00:18:08 +0000 |
| commit | db83aceb0686c25c1a5d3db2e776bc8c9b0de3ee (patch) | |
| tree | ac6a07cb3f52668da666988bbe91008368731ebc /llvm/test | |
| parent | ef61d85fc9151a0cf588c98ea91b4849bfe79e25 (diff) | |
| download | bcm5719-llvm-db83aceb0686c25c1a5d3db2e776bc8c9b0de3ee.tar.gz bcm5719-llvm-db83aceb0686c25c1a5d3db2e776bc8c9b0de3ee.zip | |
[ThinLTO] Add an option to force summary call edges cold for debugging
Summary:
Useful to selectively disable importing into specific modules for
debugging/triaging/workarounds.
Reviewers: eraman
Subscribers: inglorion, llvm-commits
Differential Revision: https://reviews.llvm.org/D45062
llvm-svn: 328909
Diffstat (limited to 'llvm/test')
3 files changed, 77 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionImport/Inputs/funcimport_forcecold.ll b/llvm/test/Transforms/FunctionImport/Inputs/funcimport_forcecold.ll new file mode 100644 index 00000000000..a59d68c1e18 --- /dev/null +++ b/llvm/test/Transforms/FunctionImport/Inputs/funcimport_forcecold.ll @@ -0,0 +1,4 @@ +define void @foo() { +entry: + ret void +} diff --git a/llvm/test/Transforms/FunctionImport/funcimport_forcecold.ll b/llvm/test/Transforms/FunctionImport/funcimport_forcecold.ll new file mode 100644 index 00000000000..a9aa77f9afe --- /dev/null +++ b/llvm/test/Transforms/FunctionImport/funcimport_forcecold.ll @@ -0,0 +1,36 @@ +; Test to ensure that building summary with -force-summary-edges-cold +; blocks importing as expected. + +; "-stats" and "-debug-only" require +Asserts. +; REQUIRES: asserts + +; First do with default options, which should import +; RUN: opt -module-summary %s -o %t.bc +; RUN: opt -module-summary %p/Inputs/funcimport_forcecold.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT + +; Next rebuild caller module summary with non-critical edges forced cold (which +; should affect all edges in this test as we don't have any sample pgo). +; Make sure we don't import. +; RUN: opt -force-summary-edges-cold=all-non-critical -module-summary %s -o %t.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT + +; Next rebuild caller module summary with all edges forced cold. +; Make sure we don't import. +; RUN: opt -force-summary-edges-cold=all -module-summary %s -o %t.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT + +define i32 @main() { +entry: + call void @foo() + ret i32 0 +} + +; IMPORT: Import foo +; NOIMPORT-NOT: Import foo +; IMPORT: define available_externally void @foo() +; NOIMPORT: declare void @foo() +declare void @foo() diff --git a/llvm/test/Transforms/FunctionImport/funcimport_forcecold_samplepgo.ll b/llvm/test/Transforms/FunctionImport/funcimport_forcecold_samplepgo.ll new file mode 100644 index 00000000000..4ff02b9ba0f --- /dev/null +++ b/llvm/test/Transforms/FunctionImport/funcimport_forcecold_samplepgo.ll @@ -0,0 +1,37 @@ +; Test to ensure that building summary with -force-summary-edges-cold +; blocks importing as expected. + +; "-stats" and "-debug-only" require +Asserts. +; REQUIRES: asserts + +; First do with default options, which should import +; RUN: opt -module-summary %s -o %t.bc +; RUN: opt -module-summary %p/Inputs/funcimport_forcecold.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT + +; Next rebuild caller module summary with only non-critical edges forced cold, +; which should still import in this case. +; RUN: opt -force-summary-edges-cold=all-non-critical -module-summary %s -o %t.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT + +; Next rebuild caller module summary with all edges forced cold. +; Make sure we don't import. +; RUN: opt -force-summary-edges-cold=all -module-summary %s -o %t.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT + +define i32 @main() !prof !1 { +entry: + call void @foo() + ret i32 0 +} + +; IMPORT: Import foo +; NOIMPORT-NOT: Import foo +; IMPORT: define available_externally void @foo() +; NOIMPORT: declare void @foo() +declare void @foo() + +!1 = !{!"function_entry_count", i64 110, i64 6699318081062747564} |

