[llvm] r284957 - [llvm-opt-report] Fix unroll-count reporting
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 23 22:07:19 PDT 2016
Author: hfinkel
Date: Mon Oct 24 00:07:18 2016
New Revision: 284957
URL: http://llvm.org/viewvc/llvm-project?rev=284957&view=rev
Log:
[llvm-opt-report] Fix unroll-count reporting
Fix the implementation of OptReportLocationInfo's operator < so that contexts
with different unroll counts are reported separately.
Added:
llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.c
llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.yaml
llvm/trunk/test/tools/llvm-opt-report/func-3.test
Modified:
llvm/trunk/tools/llvm-opt-report/OptReport.cpp
Added: llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.c?rev=284957&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.c (added)
+++ llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.c Mon Oct 24 00:07:18 2016
@@ -0,0 +1,14 @@
+void bar();
+void foo(int n) {
+ for (int i = 0; i < n; ++i)
+ bar();
+}
+
+void quack() {
+ foo(4);
+}
+
+void quack2() {
+ foo(8);
+}
+
Added: llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.yaml?rev=284957&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.yaml (added)
+++ llvm/trunk/test/tools/llvm-opt-report/Inputs/q3.yaml Mon Oct 24 00:07:18 2016
@@ -0,0 +1,98 @@
+--- !Missed
+Pass: inline
+Name: NoDefinition
+DebugLoc: { File: Inputs/q3.c, Line: 4, Column: 5 }
+Function: foo
+Args:
+ - Callee: bar
+ - String: ' will not be inlined into '
+ - Caller: foo
+ - String: ' because its definition is unavailable'
+...
+--- !Analysis
+Pass: inline
+Name: CanBeInlined
+DebugLoc: { File: Inputs/q3.c, Line: 8, Column: 3 }
+Function: quack
+Args:
+ - Callee: foo
+ - String: ' can be inlined into '
+ - Caller: quack
+ - String: ' with cost='
+ - Cost: '40'
+ - String: ' (threshold='
+ - Threshold: '275'
+ - String: ')'
+...
+--- !Passed
+Pass: inline
+Name: Inlined
+DebugLoc: { File: Inputs/q3.c, Line: 8, Column: 3 }
+Function: quack
+Args:
+ - Callee: foo
+ - String: ' inlined into '
+ - Caller: quack
+...
+--- !Passed
+Pass: loop-unroll
+Name: FullyUnrolled
+DebugLoc: { File: Inputs/q3.c, Line: 3, Column: 3 }
+Function: quack
+Args:
+ - String: 'completely unrolled loop with '
+ - UnrollCount: '4'
+ - String: ' iterations'
+...
+--- !Analysis
+Pass: inline
+Name: CanBeInlined
+DebugLoc: { File: Inputs/q3.c, Line: 12, Column: 3 }
+Function: quack2
+Args:
+ - Callee: foo
+ - String: ' can be inlined into '
+ - Caller: quack2
+ - String: ' with cost='
+ - Cost: '40'
+ - String: ' (threshold='
+ - Threshold: '275'
+ - String: ')'
+...
+--- !Passed
+Pass: inline
+Name: Inlined
+DebugLoc: { File: Inputs/q3.c, Line: 12, Column: 3 }
+Function: quack2
+Args:
+ - Callee: foo
+ - String: ' inlined into '
+ - Caller: quack2
+...
+--- !Passed
+Pass: loop-unroll
+Name: FullyUnrolled
+DebugLoc: { File: Inputs/q3.c, Line: 3, Column: 3 }
+Function: quack2
+Args:
+ - String: 'completely unrolled loop with '
+ - UnrollCount: '8'
+ - String: ' iterations'
+...
+--- !Analysis
+Pass: loop-vectorize
+Name: CantVectorizeCall
+DebugLoc: { File: Inputs/q3.c, Line: 4, Column: 5 }
+Function: foo
+Args:
+ - String: 'loop not vectorized: '
+ - String: call instruction cannot be vectorized
+...
+--- !Missed
+Pass: loop-vectorize
+Name: MissedDetails
+DebugLoc: { File: Inputs/q3.c, Line: 3, Column: 3 }
+Function: foo
+Args:
+ - String: 'loop not vectorized: use -Rpass-analysis=loop-vectorize for more info'
+...
Added: llvm/trunk/test/tools/llvm-opt-report/func-3.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-opt-report/func-3.test?rev=284957&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-opt-report/func-3.test (added)
+++ llvm/trunk/test/tools/llvm-opt-report/func-3.test Mon Oct 24 00:07:18 2016
@@ -0,0 +1,25 @@
+RUN: llvm-opt-report -r %p %p/Inputs/q3.yaml | FileCheck -strict-whitespace %s
+
+; CHECK: < {{.*[/\]}}q3.c
+; CHECK-NEXT: 1 | void bar();
+; CHECK-NEXT: 2 | void foo(int n) {
+; CHECK-NEXT: {{\[\[}}
+; CHECK-NEXT: > foo:
+; CHECK-NEXT: 3 | for (int i = 0; i < n; ++i)
+; CHECK-NEXT: > quack:
+; CHECK-NEXT: 3 U4 | for (int i = 0; i < n; ++i)
+; CHECK-NEXT: > quack2:
+; CHECK-NEXT: 3 U8 | for (int i = 0; i < n; ++i)
+; CHECK-NEXT: {{\]\]}}
+; CHECK-NEXT: 4 | bar();
+; CHECK-NEXT: 5 | }
+; CHECK-NEXT: 6 |
+; CHECK-NEXT: 7 | void quack() {
+; CHECK-NEXT: 8 I | foo(4);
+; CHECK-NEXT: 9 | }
+; CHECK-NEXT: 10 |
+; CHECK-NEXT: 11 | void quack2() {
+; CHECK-NEXT: 12 I | foo(8);
+; CHECK-NEXT: 13 | }
+; CHECK-NEXT: 14 |
+
Modified: llvm/trunk/tools/llvm-opt-report/OptReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-opt-report/OptReport.cpp?rev=284957&r1=284956&r2=284957&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-opt-report/OptReport.cpp (original)
+++ llvm/trunk/tools/llvm-opt-report/OptReport.cpp Mon Oct 24 00:07:18 2016
@@ -132,7 +132,7 @@ struct OptReportLocationInfo {
return true;
else if (InterleaveCount > RHS.InterleaveCount)
return false;
- else if (InterleaveCount < RHS.InterleaveCount)
+ else if (UnrollCount < RHS.UnrollCount)
return true;
return false;
}
More information about the llvm-commits
mailing list