[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 06:25:33 +08:00
|
|
|
RUN: llvm-opt-report -r %p %p/Inputs/q.yaml | FileCheck -strict-whitespace %s
|
|
|
|
RUN: llvm-opt-report -s -r %p %p/Inputs/q.yaml | FileCheck -strict-whitespace -check-prefix=CHECK-SUCCINCT %s
|
|
|
|
|
2016-10-06 06:48:13 +08:00
|
|
|
; CHECK: < {{.*[/\]}}q.c
|
2016-10-08 08:26:54 +08:00
|
|
|
; CHECK-NEXT: 1 | void bar();
|
|
|
|
; CHECK-NEXT: 2 | void foo(int n) {
|
2016-10-06 19:11:11 +08: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 06:25:33 +08:00
|
|
|
; CHECK-NEXT: > foo:
|
2016-10-08 08:26:54 +08: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 06:25:33 +08:00
|
|
|
; CHECK-NEXT: > quack, quack2:
|
2016-10-08 08:26:54 +08:00
|
|
|
; CHECK-NEXT: 3 U4 | for (int i = 0; i < n; ++i)
|
2016-10-06 19:11:11 +08:00
|
|
|
; CHECK-NEXT: {{\]\]}}
|
2016-10-08 08:26:54 +08: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 06:25:33 +08:00
|
|
|
|
2016-10-06 06:48:13 +08:00
|
|
|
; CHECK-SUCCINCT: < {{.*[/\]}}q.c
|
2016-10-08 08:26:54 +08:00
|
|
|
; CHECK-SUCCINCT-NEXT: 1 | void bar();
|
|
|
|
; CHECK-SUCCINCT-NEXT: 2 | void foo(int n) {
|
2016-10-06 19:11:11 +08: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 06:25:33 +08:00
|
|
|
; CHECK-SUCCINCT-NEXT: > foo:
|
2016-10-08 08:26:54 +08: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 06:25:33 +08:00
|
|
|
; CHECK-SUCCINCT-NEXT: > quack, quack2:
|
2016-10-08 08:26:54 +08:00
|
|
|
; CHECK-SUCCINCT-NEXT: 3 U | for (int i = 0; i < n; ++i)
|
2016-10-06 19:11:11 +08:00
|
|
|
; CHECK-SUCCINCT-NEXT: {{\]\]}}
|
2016-10-08 08:26:54 +08: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 06:25:33 +08:00
|
|
|
|