Add an API that allows removing multiple incoming phi values based on a predicate callback, as suggested on D157621.
This makes sure that the removal is linear time rather than quadratic, and avoids subtleties around iterator invalidation.
I have replaced some of the more straightforward users with the new API, though there's a couple more places that should be able to use it.
This isn't the most efficient implementation... instead of using a set, you could iterate over the value operands and the blocks at the same time. But I guess we can improve it later if it matters.