[FuzzMutate] Add mutator to modify instruction flags.
authorFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 15:28:57 +0000 (15:28 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 19:05:20 +0000 (19:05 +0000)
commit166d40f2ed3db1ddd2868b23d496b4e299d99533
tree31fea4547c0184d6539d1c5da63286c08f6233d8
parent3b9677e1eced0eafc17bdf3f6a41f1fd7db9f120
[FuzzMutate] Add mutator to modify instruction flags.

This patch adds a new InstModificationIRStrategy to mutate flags/options
for instructions. For example, it may add or remove nuw/nsw flags from
add, mul, sub, shl instructions or change the predicate for icmp
instructions.

Subtle changes such as those mentioned above should lead to a more
interesting range of inputs. The presence or absence of overflow flags
can expose subtle bugs, for example.

Reviewed By: bogner

Differential Revision: https://reviews.llvm.org/D94905
llvm/include/llvm/FuzzMutate/IRMutator.h
llvm/lib/FuzzMutate/IRMutator.cpp
llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
llvm/unittests/FuzzMutate/StrategiesTest.cpp