summaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-03-15 04:42:01 +0000
committerYonghong Song <yhs@fb.com>2019-03-15 04:42:01 +0000
commit5664d4c8cae925cb04994c6e7e46342aacc64bec (patch)
tree5c0776a988665c3287105ad0c010593bf6b06749 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentef1e06df6ff153ba961608220a8467577c8ccd43 (diff)
[BPF] do not generate unused local/global types
The kernel currently has a limit for # of types to be 64KB and the size of string subsection to be 64KB. A simple bcc tool runqlat.py generates: . the size of ~33KB type section, roughly ~10K types . the size of ~17KB string section The majority type is from the types referenced by local variables in the bpf program. For example, the kernel "task_struct" itself recursively brings in ~900 other types. This patch did the following optimization to avoid generating unused types: . do not generate types for local variables unless they are function arguments. . do not generate types for external globals. If an external global is not used in the program, llvm already removes it from IR, so global variable saving is typical small. For runqlat.py, only one variable "llvm.used" is the external global. The types for locals and external globals can be added back once there is a usage for them. After the above optimization, the runqlat.py generates: . the size of ~1.5KB type section, roughtly 500 types . the size of ~0.7KB string section Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 356232
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions