[clang] [llvm] [LLVM][Support] Enforce proper instantiations of `Registry<T>` (PR #185141)
Tomohiro Kashiwada via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 05:54:50 PDT 2026
kikairoya wrote:
> > > Does it have measured perf implications that we should consider?
> >
> >
> > I haven't measured, however, accessing `Registry<T>` shouldn't be in a hot-path, so I think there is no major impact. For build-time, `Registry<T>` itself is a quite simple template, and I don't think so many TUs instantiate it with the same parameters, so I guess it's not significant.
>
> Sorry about not being clear, I meant compile time performance implications, i.e. does this change the compile times/sizes meaningfully for MSVC, clang, or gcc? That is fair, it it is a pretty simple member, so it shouldn't be too expensive to materialise, but the problem is on the linking side where the deduplication needs to occur.
Give me a moment to take some measurements.
The amount of duplication is the number of `Registry<T>::Add<V> X(...)` registrations for each `T`, so I guess that is not a heavy task.
Or, inlining `add_node` into `Add<V>::Add` could be eliminate the duplications.
https://github.com/llvm/llvm-project/pull/185141
More information about the cfe-commits
mailing list