A few inline comments --
"the given edge" is now a bit vague. Could you update the docstring?
IMO this is fine as a comment.
If you think it's a good idea to lift this explanation into the assert, I suggest shortening it a bit.
Same comment as above.
I assume you are hitting this in switch statements or something similar. I triggered the same in NewGVN.
Note that the comment in dominates is simply wrong.
I discussed with this Rafael (who added this). The callers can, in fact, do *nothing* different than what the function would have to do, and in fact, would have to duplicate a ton of complicated critical edge logic that Dominates handles. That seems really bad to me.
Nowhere else in LLVM do we *assert* because a very dumb caller may cause a performance problem.
The right fix here is to simply remove the assert, and make sure your caller is smart about not calling this unnecessarily.
(IE cache the value of edge domination in cases like this).