smite-ir: Add InstructionDeleteMutator#60
Conversation
Are there any advantages to having two ways to delete an operation? If not, I would prefer to use only |
If we only keep the If we want to only keep one mutation scheme, I say we should go with index renumbering.
Yes, we handle that in this part of the code. We first check if any operation uses our deleted instruction as input. If yes, we search for a previously defined instruction with the same type as the deleted one (returns false if no such instruction exists) and then replace instances of our deleted instruction with the found replacement. |
|
Perhaps there's a middle path -- we could have our mutators insert |
Sounds good to me. |
If I'm not wrong, the Looks to me like we're deferring complexity in the mutator to other parts of the codebase. Why not make the mutator never introduce Unless of course, if it's better for |
|
After reconsidering, it likely makes sense to remove I'll rewrite my trimmer/minimizer PR to also do remove-and-reindex, but more aggressively, for all instructions that have no consumers, while maintaining the same coverage. Subsequent mutations should then be more efficient, since they won't waste exec budget mutating dead IR. What do you think @morehouse @Chand-ra ? |
Sounds good to me. But as Matt mentioned earlier, maybe inserting |
Either way is fine to me. If you both prefer going with |
I'll let Matt take the call on this, seeing how
I'm personally leaning towards reindexing because:
|
|
Let's ditch Nop entirely and rewrite instead. |
|
Rewrote the mutator and accompanying tests without the |
morehouse
left a comment
There was a problem hiding this comment.
The same concern described in #61 (review) applies here: if we delete a SendMessage that precedes a Recv* operation, we may force a 5s timeout when executing the input.
I think we need a good solution to this issue before we can merge this mutator.
| "mutator never took the expected target shift path" | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
It would be good to also test deletion of a void-output operation (i.e. SendMessage).
There was a problem hiding this comment.
I cannot say I see the merit in it, the only "interesting" thing that happens (from the mutator's perspective) on deleting a void-output operation is index-shifting of downstream instructions, which is tested here anyway. Maybe I'm missing something?
|
Haven't squashed the changes yet because we won't merge this without solving the 'implicit dependence' issue anyway, and it should ease the reviewing. |
Add an
InstructionDeletemutator for Smite IR. Mutates a given program by deleting a randomly selected instruction.Deletion of an instruction can happen in one of two ways:
(i) Replacing it with a
Operation::Nop(50% chance).(ii) Removing it from the instructions list and reindexing the subsequent instructions (50% chance).