[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
RUN: llvm-opt-report -r %p %p/Inputs/qx.yaml | FileCheck -strict-whitespace %s
|
2016-10-07 03:30:59 +02:00
|
|
|
RUN: llvm-opt-report -no-demangle -r %p %p/Inputs/qx.yaml | FileCheck -strict-whitespace -check-prefix=CHECK-NODEM %s
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
RUN: llvm-opt-report -s -r %p %p/Inputs/qx.yaml | FileCheck -strict-whitespace -check-prefix=CHECK-SUCCINCT %s
|
|
|
|
|
2016-10-06 00:48:13 +02:00
|
|
|
; CHECK: < {{.*[/\]}}q.cpp
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NEXT: 1 | void bar();
|
|
|
|
; CHECK-NEXT: 2 | void foo(int n) {
|
2016-10-06 13:11:11 +02:00
|
|
|
; CHECK-NEXT: {{\[\[}}
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
; CHECK-NEXT: > foo(int):
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NEXT: 3 | for (int i = 0; i < n; ++i)
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
; CHECK-NEXT: > quack(), quack2():
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NEXT: 3 U4 | for (int i = 0; i < n; ++i)
|
2016-10-06 13:11:11 +02:00
|
|
|
; CHECK-NEXT: {{\]\]}}
|
2016-10-08 02:26:54 +02:00
|
|
|
; 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(4);
|
|
|
|
; CHECK-NEXT: 13 | }
|
|
|
|
; CHECK-NEXT: 14 |
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
|
2016-10-07 03:30:59 +02:00
|
|
|
; CHECK-NODEM: < {{.*[/\]}}q.cpp
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NODEM-NEXT: 1 | void bar();
|
|
|
|
; CHECK-NODEM-NEXT: 2 | void foo(int n) {
|
2016-10-07 03:30:59 +02:00
|
|
|
; CHECK-NODEM-NEXT: {{\[\[}}
|
|
|
|
; CHECK-NODEM-NEXT: > _Z3fooi:
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NODEM-NEXT: 3 | for (int i = 0; i < n; ++i)
|
2016-10-07 03:30:59 +02:00
|
|
|
; CHECK-NODEM-NEXT: > _Z5quackv, _Z6quack2v:
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NODEM-NEXT: 3 U4 | for (int i = 0; i < n; ++i)
|
2016-10-07 03:30:59 +02:00
|
|
|
; CHECK-NODEM-NEXT: {{\]\]}}
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-NODEM-NEXT: 4 | bar();
|
|
|
|
; CHECK-NODEM-NEXT: 5 | }
|
|
|
|
; CHECK-NODEM-NEXT: 6 |
|
|
|
|
; CHECK-NODEM-NEXT: 7 | void quack() {
|
|
|
|
; CHECK-NODEM-NEXT: 8 I | foo(4);
|
|
|
|
; CHECK-NODEM-NEXT: 9 | }
|
|
|
|
; CHECK-NODEM-NEXT: 10 |
|
|
|
|
; CHECK-NODEM-NEXT: 11 | void quack2() {
|
|
|
|
; CHECK-NODEM-NEXT: 12 I | foo(4);
|
|
|
|
; CHECK-NODEM-NEXT: 13 | }
|
|
|
|
; CHECK-NODEM-NEXT: 14 |
|
2016-10-07 03:30:59 +02:00
|
|
|
|
2016-10-06 00:48:13 +02:00
|
|
|
; CHECK-SUCCINCT: < {{.*[/\]}}q.cpp
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: 1 | void bar();
|
|
|
|
; CHECK-SUCCINCT-NEXT: 2 | void foo(int n) {
|
2016-10-06 13:11:11 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: {{\[\[}}
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: > foo(int):
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: 3 | for (int i = 0; i < n; ++i)
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: > quack(), quack2():
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: 3 U | for (int i = 0; i < n; ++i)
|
2016-10-06 13:11:11 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: {{\]\]}}
|
2016-10-08 02:26:54 +02:00
|
|
|
; CHECK-SUCCINCT-NEXT: 4 | bar();
|
|
|
|
; CHECK-SUCCINCT-NEXT: 5 | }
|
|
|
|
; CHECK-SUCCINCT-NEXT: 6 |
|
|
|
|
; CHECK-SUCCINCT-NEXT: 7 | void quack() {
|
|
|
|
; CHECK-SUCCINCT-NEXT: 8 I | foo(4);
|
|
|
|
; CHECK-SUCCINCT-NEXT: 9 | }
|
|
|
|
; CHECK-SUCCINCT-NEXT: 10 |
|
|
|
|
; CHECK-SUCCINCT-NEXT: 11 | void quack2() {
|
|
|
|
; CHECK-SUCCINCT-NEXT: 12 I | foo(4);
|
|
|
|
; CHECK-SUCCINCT-NEXT: 13 | }
|
|
|
|
; CHECK-SUCCINCT-NEXT: 14 |
|
[llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.
For example, this code:
$ cat /tmp/q.cpp
void bar();
void foo(int n) {
for (int i = 0; i < n; ++i)
bar();
}
void quack() {
foo(4);
}
void quack2() {
foo(4);
}
will now produce this report:
< /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
2 | void bar();
3 | void foo(int n) {
[[
> foo(int):
4 | for (int i = 0; i < n; ++i)
> quack(), quack2():
4 U4 | for (int i = 0; i < n; ++i)
]]
5 | bar();
6 | }
7 |
8 | void quack() {
9 I | foo(4);
10 | }
11 |
12 | void quack2() {
13 I | foo(4);
14 | }
15 |
Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.
llvm-svn: 283402
2016-10-06 00:25:33 +02:00
|
|
|
|