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. |
|
We need to make this mutator respect affine rules by construction now, but I am confused on how to go about this. If we select an affine-producing operation to delete, we can either:
I don't think we want to do 1, but I'm unsure which one is better among 2 and 3. WDYT @morehouse @NishantBansal2003? Edit: After some thought, I think 3 wouldn't be right either. We'd have to implement an entirely different scheme for affine types and it would delete entire protocol flows which is not what we're trying to do with this mutator, but rather delete a single instruction. |
|
IMO, deletion of both I’d go with option 2: try to heal the EDIT: I didn’t see your edit ;). Looks like we came to the same conclusion |
|
Smoke tested a 10-minute IR fuzz run against LDK. No issues. |
Add an
InstructionDeletemutator for Smite IR. Mutates a given program by deleting a randomly selected instruction. Deletion of the said instruction happens by removing it from the instructions list and reindexing the subsequent instructions.