Open afd opened 3 years ago
@Vasniktel perhaps you could take a look and see whether FuzzerPassReplaceIrrelevantIds already handles what we want to do.
It doesn't because TransformationReplaceIrrelevantId
doesn't support it. For example, if the following instruction is in a dead block %1 = OpIAdd %int %const_1 %const_1
then we can't replace %const_1 with any other integral id if %const_1 is not irrelevant. And it might not be irrelevant since it's not defined in a dead block.
That is, in the preceding example TransformationReplaceIrrelevantId
won't allow us to make a replacement because it requires %const_1 to be irrelevant.
We can adjust TransformationReplaceIrrelevantId
to support that use case. @afd, what do you think?
For good reasons we are going to ban creation of synonyms in dead blocks, because ids in dead blocks are regarded as irrelevant and having synonyms of irrelevant ids doesn't make sense.
However, within dead blocks there is no harm in replacing a use of an id with a definition of any other available id with the same type.
Therefore we should have a new fuzzer pass that does this, or check whether this is already adequately handled by FuzzerPassReplaceIrrelevantIds (perhaps it is).