[all-commits] [llvm/llvm-project] 39b6a7: [FuzzMutate] Module size heuristics
Zhenkai Weng via All-commits
all-commits at lists.llvm.org
Tue May 9 13:58:23 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 39b6a7f06ea970db6b09932a4582376fba71f6b9
https://github.com/llvm/llvm-project/commit/39b6a7f06ea970db6b09932a4582376fba71f6b9
Author: Zhenkai Weng <theoaktree1040 at gmail.com>
Date: 2023-05-09 (Tue, 09 May 2023)
Changed paths:
M llvm/include/llvm/FuzzMutate/IRMutator.h
M llvm/lib/FuzzMutate/IRMutator.cpp
M llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
M llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
M llvm/unittests/FuzzMutate/StrategiesTest.cpp
Log Message:
-----------
[FuzzMutate] Module size heuristics
IRMutation::mutateModule() currently requires the bitcode size of the module.
To compute the bitcode size, one way is to write the module to a buffer using
BitcodeWriter and calculating the buffer size. This would be fine for a single
mutation, but infeasible for repeated mutations due to the large overhead. It
turns out that the only IR strategy weight calculation method that depends on
the current module size is InstDeleterStrategy, which deletes instructions more
frequently as the module size approaches a given max size. However, there is no
real need for the size to be in bytes of bitcode, so we can use a different
metric. One alternative is to let the size be the number of objects in the
Module, including instructions, basic blocks, globals, and aliases. Although
getting the number of instructions is still O(n), it should have significantly
less overhead than BitcodeWriter. This suggestion would cause a change to the
IRMutator API, since IRMutator::mutateModule() can calculate the Module size
itself.
Reviewed By: Peter
Differential Revision: https://reviews.llvm.org/D149989
More information about the All-commits
mailing list