[llvm][Support] Avoid intermediate heap allocations in `StringSaver`
The `Twine::str()` function currently always allocates heap memory via `std::string`. However, some instances of `Twine` don't need an intermediate buffer at all, and the rest can attempt to print into a stack buffer first. This is intentionally not making use of `Twine::isSingleStringLiteral()` from D157010 to skip saving the string in the bump-pointer allocator, since the `StringSaver` documentation suggests that MUST happen for every given string. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D157015
Loading
Please sign in to comment