[FuzzMutate] RandomIRBuilder has more source and sink type now.
authorPeter Rong <PeterRong96@gmail.com>
Tue, 13 Dec 2022 03:04:41 +0000 (19:04 -0800)
committerPeter Rong <PeterRong96@gmail.com>
Sat, 15 Apr 2023 22:46:40 +0000 (15:46 -0700)
commite0117a3efacf9620408393f162a7795b5e0965d2
tree135e8adde8ca59118e093b631e58f498e28465b9
parent6128bcd02512eeb0e0bbb8b0a9c4d82f6f9427b2
[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