[libcxx-commits] [PATCH] D59999: Make it easier for the compiler to optimize `operator==(string, char*)`.
Samuel Benzaquen via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 29 14:21:14 PDT 2019
sbenza added a comment.
Thanks for debugging that. I didn't realize it didn't try to inline on purpose.
Maybe we just need to mark the function as `inline`, even if we also have the extern template instantiation.
That way the compiler can inline it if it helps, but won't actually generate the weak symbol in the object files otherwise.
Eg, something like:
@@ -3709,7 +3709,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) co
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
const value_type* __s,
does the same job without requiring changes to the implementation.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits