[patch] Don't rename in Module::getOrInsertFunction.

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Mar 10 11:52:49 PDT 2014


On Mar 10, 2014, at 11:35 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:

> Duncan recently reminded me that Module::getOrInsertFunction can
> rename globals to make the new one fit. That is fairly surprising,
> given the name of the function and what a central part of llvm it is.
> 
> Going over git log it looks like this was done to help with the
> transition out of type planes. I have already done a simple "ninja
> check-all" and both clang's and llvm's tests are clear. I will also
> try a bootstrap and running the llvm testsuite.
> 
> Is the attached patch OK if all of the above works?
> 
> Cheers,
> Rafael
> <t.patch>

I actually started with this (see [1]), but I imagined some use cases where
the current behaviour might be correct.  For example, what if someone gives
a static function the same name as a libc function that they aren’t using
(and maybe don’t even know about), and then LLVM inserts a use of the libc
function.  Should this use call their potentially unrelated function, or
the libc function?

[1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140224/206842.html



More information about the llvm-commits mailing list