[PATCH] D96109: Refactor implementation of -funique-internal-linkage-names.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 12:26:16 PST 2021


rnk added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1251
                                       ->getMostRecentDecl();
     std::string OtherName = getMangledNameImpl(*this, OtherGD, OtherFD);
     // This is so that if the initial version was already the 'default'
----------------
This raises the original concern that I had that pushed me in the direction of doing things as a pass: How does this interact with multi-version functions? It probably just works, but I remember this was something that made me think an IR pass would be simpler, or more likely to do the right thing.

Something else to think about: clang has other ways to generate internal functions with non-unique names. Dynamic initialization comes to mind (`__cxx_global_var_init`). Consider:
```
template <typename T>
struct Foo { static int gv; };
int f(int);
template <typename T>
int Foo<T>::gv = f(sizeof(T));
void escape(int*);
void instantiate() {
  escape(&Foo<int>::gv);
  escape(&Foo<short>::gv);
}
```
The IR pass was renaming these for us previously.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96109/new/

https://reviews.llvm.org/D96109



More information about the llvm-commits mailing list