[FuzzMutate] RandomIRBuilder has more source and sink type now.
authorPeter Rong <PeterRong96@gmail.com>
Mon, 17 Apr 2023 19:10:18 +0000 (12:10 -0700)
committerPeter Rong <PeterRong96@gmail.com>
Mon, 17 Apr 2023 21:45:09 +0000 (14:45 -0700)
commit64ce140fa60846b4dc17b1212c4c8e8a22965622
tree33f6232e4b729554a2f1b3a2340c745137932af0
parentf1da04b7357bf0efef2ab881f31bdfb30c3e3b10
[FuzzMutate] RandomIRBuilder has more source and sink type now.

Source and Sink are required when generating a new instruction.
(Term defined by previous author, in LLVM terms it's probably Use and User.)
Previously, only instructions in the same block is considered when taking source and sink.

In this patch, more source and sink types are considered.
For source, we have SrcFromInstInCurBlock, FunctionArgument, InstInDominator, SrcFromGlobalVariable, and NewConstOrStack.
For sink, we have SinkToInstInCurBlock, PointersInDominator, InstInDominatee, NewStore, and SinkToGlobalVariable.

A unit test to make sure source always dominates an instruction, and the instruction always dominates the sink is included.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D139907
llvm/include/llvm/FuzzMutate/RandomIRBuilder.h
llvm/lib/FuzzMutate/RandomIRBuilder.cpp
llvm/unittests/FuzzMutate/RandomIRBuilderTest.cpp