Commit 0c35ca2
bpf: Remove 'may_goto 0' instruction in opt_remove_nops()
Since 'may_goto 0' insns are actually no-op, let us remove them.
Otherwise, verifier will generate code like
/* r10 - 8 stores the implicit loop count */
r11 = *(u64 *)(r10 -8)
if r11 == 0x0 goto pc+2
r11 -= 1
*(u64 *)(r10 -8) = r11
which is the pure overhead.
The following code patterns (from the previous commit) are also
handled:
may_goto 2
may_goto 1
may_goto 0
With this commit, the above three 'may_goto' insns are all
eliminated.
Signed-off-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>1 parent aefaa43 commit 0c35ca2
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20184 | 20184 | | |
20185 | 20185 | | |
20186 | 20186 | | |
| 20187 | + | |
20187 | 20188 | | |
20188 | 20189 | | |
20189 | 20190 | | |
20190 | | - | |
20191 | 20191 | | |
20192 | 20192 | | |
| 20193 | + | |
20193 | 20194 | | |
20194 | 20195 | | |
20195 | 20196 | | |
20196 | | - | |
| 20197 | + | |
| 20198 | + | |
| 20199 | + | |
| 20200 | + | |
20197 | 20201 | | |
20198 | 20202 | | |
20199 | 20203 | | |
20200 | 20204 | | |
20201 | 20205 | | |
20202 | 20206 | | |
20203 | | - | |
| 20207 | + | |
| 20208 | + | |
20204 | 20209 | | |
20205 | 20210 | | |
20206 | 20211 | | |
| |||
0 commit comments