]> gcc.gnu.org Git - gcc.git/commit
bpf: add size threshold for inlining mem builtins
authorDavid Faust <david.faust@oracle.com>
Thu, 7 Mar 2024 17:29:32 +0000 (09:29 -0800)
committerDavid Faust <david.faust@oracle.com>
Fri, 8 Mar 2024 18:12:42 +0000 (10:12 -0800)
commit0e850eff58539fb79483664962fac6c46d65c79d
tree2653b6bc6210b0450eb6af40bb28d124807dcebc
parentac829a89fb56cfd914d5e29ed4695e499b0dbc95
bpf: add size threshold for inlining mem builtins

BPF cannot fall back on library calls to implement memmove, memcpy and
memset, so we attempt to expand these inline always if possible.
However, this inline expansion was being attempted even for excessively
large operations, which could result in gcc consuming huge amounts of
memory and hanging.

Add a size threshold in the BPF backend below which to always expand
these operations inline, and introduce an option
-minline-memops-threshold= to control the threshold. Defaults to
1024 bytes.

gcc/

* config/bpf/bpf.cc (bpf_expand_cpymem, bpf_expand_setmem): Do
not attempt inline expansion if size is above threshold.
* config/bpf/bpf.opt (-minline-memops-threshold): New option.
* doc/invoke.texi (eBPF Options) <-minline-memops-threshold>:
Document.

gcc/testsuite/

* gcc.target/bpf/inline-memops-threshold-1.c: New test.
* gcc.target/bpf/inline-memops-threshold-2.c: New test.
gcc/config/bpf/bpf.cc
gcc/config/bpf/bpf.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/bpf/inline-memops-threshold-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/bpf/inline-memops-threshold-2.c [new file with mode: 0644]
This page took 0.060003 seconds and 5 git commands to generate.