clover: Reserve vector memory in make_text_section

This isn't strictly required, but it works around
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366 , and it might
avoid a memory reallocation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21236>
This commit is contained in:
Michel Dänzer 2023-02-13 12:54:12 +01:00 committed by Marge Bot
parent 53ce756eeb
commit 2a626f999a

View file

@ -125,6 +125,7 @@ namespace {
const pipe_binary_program_header header { uint32_t(code.size()) };
binary::section text { 0, section_type, header.num_bytes, {} };
text.data.reserve(sizeof(header) + header.num_bytes);
text.data.insert(text.data.end(), reinterpret_cast<const char *>(&header),
reinterpret_cast<const char *>(&header) + sizeof(header));
text.data.insert(text.data.end(), code.begin(), code.end());