I have a pass that duplicates all instructions and keeps a "reference
map" of duplicated values, which is later used to update all the
references, thus creating a whole copy of a previous function. How I was
doing it is calling "replaceUsesOfWith" in all the replicated
This used to work on 2.9 and older, in svn it no longer does in the case
of PHI nodes, because the BasicBlocks are not "uses" in the PHI node. I
have read in the svn log that "replaceAllUsesWith" was updated to cope
with this, but in my case I do not want to replace all uses of the basic
block, only those *in the replicated* instructions.
I can make a special case in my code to solve this, but my question is:
should replaceUsesOfWith be overloaded in PHI so it mimics the previous
behaviour? PHINode inherits from User, after all, it being an
instruction, and it is a little confusing not to be able to replace its
Or maybe I am just missing something?