[PATCH] D33162: IR: Give function GlobalValue::getRealLinkageName() a less misleading name: getPGOName().

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 15:19:32 PDT 2017


pcc added a comment.

In https://reviews.llvm.org/D33162#755514, @rnk wrote:

> In https://reviews.llvm.org/D33162#754180, @pcc wrote:
>
> > > Most of the uses reads quite wrong since it has nothing to do with PGO.
> >
> > Yes, that's the point :)
> >
> > Use of a function named getPGOName() in code that has nothing to do with PGO stands out and makes it more obvious that there is a bug. Using a "better" name would increase the chance of the function being used incorrectly in other places.
>
>
> Let's go ahead and try to come up with a better name without solving the real problem. I'd focus on something really mechanical, since this is truly a low-level mechanical function. If you really want the object file name, you need DataLayout. Actually, why not fold Mangler into DataLayout? Mangler::getNameWithPrefix doesn't use any instance variables.
>
> Anyway, I nominate something like `dropLLVMManglingEscape`. In contexts like DiagnosticInfo.cpp it should be clear to the reader that this is correct. In contexts like ASan, DataLayout should be available and we should use it.


That name works for me; done.


https://reviews.llvm.org/D33162





More information about the llvm-commits mailing list