Commit 938222e
Yonghong Song
[BPF] Avoid potential long compilation time without -g
Alastair Robertson reported a huge compilation time increase
without -g for bpf target when comparing to x86 ([1]). In my setup,
with '-O0', for x86, a large basic block compilation takes 0.19s
while bpf target takes 2.46s. The top function which contributes
to the compile time is eliminateFrameIndex().
Such long compilation time without -g is caused by commit
05de2e4 ("[bpf] error when BPF stack size exceeds 512 bytes")
The compiler tries to get some debug loc by iterating all insns
in the basic block which will be used when compiler warns
larger-than-512 stack size. Even without -g, such iterating also
happens which cause unnecessary compile time increase.
To fix the issue, let us move the related code when the compiler
is about to warn stack limit violation. This fixed the
compile time regression, and on my system, the compile time
is reduced from 2.46s to 0.35s.
[1] bpftrace/bpftrace#32571 parent dc27ff1 commit 938222e
1 file changed
+12
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
| |||
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
0 commit comments