Previously we were only handling bitcasts but prototypeless functions
can also appear in comparisons and as function params.Switch to using
replaceAllUsesWith() to replace the prototype-less function uses.
This new approach results in some redundant itcasting but is much
simpler and handles all cases.
Fixes PR40219