When the first commutative instruction in a region using the same value in both positions was compared to a corresponding instruction with two different values, there was an early check that determined that since the values were new, it was true that these values acted in the same way structurally. If this was not contradicted later in the program, the regions were marked as similar. This removes that check, so that it is clear that the same value cannot be mapped to two different values.
I think this is fine. I have a couple nits on the comments, but I won't hold up review over them.
I think this comment would be clearer if you said "ensure that <instruction in test> is not mapped the same as <other instruction in test>"; it's not clear to me what's going on here right now.
This is minor, but it would be really useful to have names for the variables here which describe what they're doing if possible.
%commutative_inst = mul i64 undef, undef ...