With opaque pointers, it's possible to directly call a function with a different signature, without an intermediate bitcast. However, lot's of code using getCalledFunction() reasonably assumes that the signatures match (which is always true without opaque pointers). Add an explicit check to that effect.
The test case is from D105313, where I ran into the problem, but on further investigation this also affects lots of other code, we just have little coverage with mismatching signatures. The change from D105313 is still desirable for other reasons, but this patch addresses (I believe) the root problem when it comes to opaque pointers.