diff options
author | Eli Friedman <efriedma@codeaurora.org> | 2017-08-11 21:12:04 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@codeaurora.org> | 2017-08-11 21:12:04 +0000 |
commit | 51cf2604b6879438ba142f85d264d2ca1046ef29 (patch) | |
tree | 0d696a839552540dc71a84c1de2d5f2f4277f856 /llvm/test | |
parent | ac217b7aa3987dc8a4952f213a57f985b5106bae (diff) | |
download | bcm5719-llvm-51cf2604b6879438ba142f85d264d2ca1046ef29.tar.gz bcm5719-llvm-51cf2604b6879438ba142f85d264d2ca1046ef29.zip |
[OptDiag] Updating Remarks in SampleProfile
Updating remark API to newer OptimizationDiagnosticInfo API. This
allows remarks to show up in diagnostic yaml file, and enables use
of opt-viewer tool.
Hotness information for remarks (L505 and L751) do not display hotness
information, most likely due to profile information not being
propagated yet. Unsure if this is the desired outcome.
Patch by Tarun Rajendran.
Differential Revision: https://reviews.llvm.org/D36127
llvm-svn: 310763
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Transforms/SampleProfile/cov-zero-samples.ll | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/SampleProfile/inline-coverage.ll | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/SampleProfile/remarks.ll | 42 |
3 files changed, 44 insertions, 6 deletions
diff --git a/llvm/test/Transforms/SampleProfile/cov-zero-samples.ll b/llvm/test/Transforms/SampleProfile/cov-zero-samples.ll index 5239d74fdc6..07b2d610612 100644 --- a/llvm/test/Transforms/SampleProfile/cov-zero-samples.ll +++ b/llvm/test/Transforms/SampleProfile/cov-zero-samples.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s -; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s +; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -pass-remarks-analysis=sample-profile -o /dev/null 2>&1 | FileCheck %s +; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -pass-remarks-analysis=sample-profile -o /dev/null 2>&1 | FileCheck %s ; ; CHECK: remark: cov-zero-samples.cc:9:29: Applied 404065 samples from profile (offset: 2.1) ; CHECK: remark: cov-zero-samples.cc:10:9: Applied 443089 samples from profile (offset: 3) diff --git a/llvm/test/Transforms/SampleProfile/inline-coverage.ll b/llvm/test/Transforms/SampleProfile/inline-coverage.ll index 080876a4647..0a77e1ca335 100644 --- a/llvm/test/Transforms/SampleProfile/inline-coverage.ll +++ b/llvm/test/Transforms/SampleProfile/inline-coverage.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s -; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s +; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -pass-remarks-analysis=sample-profile -o /dev/null 2>&1 | FileCheck %s +; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -pass-remarks-analysis=sample-profile -o /dev/null 2>&1 | FileCheck %s ; ; Original code: ; diff --git a/llvm/test/Transforms/SampleProfile/remarks.ll b/llvm/test/Transforms/SampleProfile/remarks.ll index dfb075ee00e..6285d69f9c7 100644 --- a/llvm/test/Transforms/SampleProfile/remarks.ll +++ b/llvm/test/Transforms/SampleProfile/remarks.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s +; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s -; +; RUN: FileCheck %s -check-prefix=YAML < %t.opt.yaml ; Original test case. ; ; 1 #include <stdlib.h> @@ -27,6 +27,44 @@ ; The predicate almost always chooses the 'else' branch. ; CHECK: remark: remarks.cc:9:15: most popular destination for conditional branches at remarks.cc:6:9 +; Checking to see if YAML file is generated and contains remarks +;YAML: --- !Passed +;YAML-NEXT: Pass: sample-profile +;YAML-NEXT: Name: HotInline +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 13, Column: 21 } +;YAML-NEXT: Function: main +;YAML-NEXT: Args: +;YAML-NEXT: - String: 'inlined hot callee ''' +;YAML-NEXT: - Callee: _Z3foov +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 3, Column: 0 } +;YAML-NEXT: - String: ''' into ''' +;YAML-NEXT: - Caller: main +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 13, Column: 0 } +;YAML-NEXT: - String: '''' +;YAML-NEXT: ... +;YAML: --- !Analysis +;YAML-NEXT: Pass: sample-profile +;YAML-NEXT: Name: AppliedSamples +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 5, Column: 8 } +;YAML-NEXT: Function: main +;YAML-NEXT: Args: +;YAML-NEXT: - String: 'Applied ' +;YAML-NEXT: - NumSamples: '18305' +;YAML-NEXT: - String: ' samples from profile (offset: ' +;YAML-NEXT: - LineOffset: '2' +;YAML-NEXT: - String: ')' +;YAML-NEXT: ... +;YAML: --- !Passed +;YAML-NEXT: Pass: sample-profile +;YAML-NEXT: Name: PopularDest +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 6, Column: 9 } +;YAML-NEXT: Function: main +;YAML-NEXT: Args: +;YAML-NEXT: - String: 'most popular destination for conditional branches at ' +;YAML-NEXT: - CondBranchesLoc: 'remarks.cc:5:3' +;YAML-NEXT: DebugLoc: { File: remarks.cc, Line: 5, Column: 3 } +;YAML-NEXT: ... + ; Function Attrs: nounwind uwtable define i64 @_Z3foov() #0 !dbg !4 { entry: |