Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
ef61d85
commit db83ace
Showing
6 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
llvm/test/Transforms/FunctionImport/Inputs/funcimport_forcecold.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
define void @foo() { | ||
entry: | ||
ret void | ||
} |
36 changes: 36 additions & 0 deletions
36
llvm/test/Transforms/FunctionImport/funcimport_forcecold.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
37 changes: 37 additions & 0 deletions
37
llvm/test/Transforms/FunctionImport/funcimport_forcecold_samplepgo.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |