Debian Codegraph @

llvm/test/tools/llvm-xray/X86/graph-deduce-tail-call.yaml

raw
1 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d \
2 #RUN: | FileCheck %s -check-prefix=EMPTY
3 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e count \
4 #RUN: | FileCheck %s -check-prefix=COUNT
5 #
6 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e min \
7 #RUN: | FileCheck %s -check-prefix=TIME
8 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e med \
9 #RUN: | FileCheck %s -check-prefix=TIME
10 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e 90p \
11 #RUN: | FileCheck %s -check-prefix=TIME
12 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e 99p \
13 #RUN: | FileCheck %s -check-prefix=TIME
14 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e max \
15 #RUN: | FileCheck %s -check-prefix=TIME
16 #RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e sum \
17 #RUN: | FileCheck %s -check-prefix=TIME
18 #
19 ---
20 header:
21 version: 1
22 type: 0
23 constant-tsc: true
24 nonstop-tsc: true
25 cycle-frequency: 0
26 records:
27 # Here we reconstruct the following call trace:
28 #
29 # f1()
30 # f2()
31 # f3()
32 #
33 # But we find that we're missing an exit record for f2() because it's
34 # tail-called f3(). We make sure that if we see a trace like this that we can
35 # deduce tail calls, and account the time (potentially wrongly) to f2() when
36 # f1() exits. That is because we don't go back to f3()'s entry record to
37 # properly do the math on the timing of f2().
38 #
39 # Note that by default, tail/sibling call deduction is disabled, and is enabled
40 # with a flag "-d" or "-deduce-sibling-calls".
41 #
42 - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter, tsc: 10000 }
43 - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10001 }
44 - { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-enter, tsc: 10002 }
45 - { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-exit, tsc: 10003 }
46 - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-exit, tsc: 10004 }
47 ...
48
49 #EMPTY: digraph xray {
50 #EMPTY-DAG: F0 -> F1 [label=""];
51 #EMPTY-DAG: F1 -> F2 [label=""];
52 #EMPTY-DAG: F2 -> F3 [label=""];
53 #EMPTY-DAG: F1 [label="@(1)"];
54 #EMPTY-DAG: F2 [label="@(2)"];
55 #EMPTY-DAG: F3 [label="@(3)"];
56 #EMPTY-NEXT: }
57
58 #COUNT: digraph xray {
59 #COUNT-DAG: F0 -> F1 [label="1"];
60 #COUNT-DAG: F1 -> F2 [label="1"];
61 #COUNT-DAG: F2 -> F3 [label="1"];
62 #COUNT-DAG: F1 [label="@(1)"];
63 #COUNT-DAG: F2 [label="@(2)"];
64 #COUNT-DAG: F3 [label="@(3)"];
65 #COUNT-NEXT: }
66
67
68 #TIME: digraph xray {
69 #TIME-DAG: F0 -> F1 [label="4.{{.*}}"];
70 #TIME-DAG: F1 -> F2 [label="3.{{.*}}"];
71 #TIME-DAG: F2 -> F3 [label="1.{{.*}}"];
72 #TIME-DAG: F1 [label="@(1)"];
73 #TIME-DAG: F2 [label="@(2)"];
74 #TIME-DAG: F3 [label="@(3)"];
75 #TIME-NEXT: }