[libcxx-commits] [PATCH] D59999: Allow the compiler to optimize `string == "literal string"`.

Samuel Benzaquen via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 29 07:33:00 PDT 2019


sbenza added a comment.

In D59999#1453709 <https://reviews.llvm.org/D59999#1453709>, @mclow.lists wrote:

> In D59999#1448376 <https://reviews.llvm.org/D59999#1448376>, @sbenza wrote:
>
> > 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.
>
>
> I don't think so, because then it would (might?) not end up in the dylib, and that would break *everything* that uses it.


What solution do you propose?
The status quo bloats and slows down callers for very common simple comparisons with literal strings.
Can we somehow mark it `inline` but force it to be in the library? Maybe with an explicit instantiation of that one function?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59999





More information about the libcxx-commits mailing list