From 2a626f999a201abf6068578ec1684f12b2b3aefb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Mon, 13 Feb 2023 12:54:12 +0100 Subject: [PATCH] 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: --- src/gallium/frontends/clover/spirv/invocation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/frontends/clover/spirv/invocation.cpp b/src/gallium/frontends/clover/spirv/invocation.cpp index 48f0d9e..b92bdb1 100644 --- a/src/gallium/frontends/clover/spirv/invocation.cpp +++ b/src/gallium/frontends/clover/spirv/invocation.cpp @@ -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(&header), reinterpret_cast(&header) + sizeof(header)); text.data.insert(text.data.end(), code.begin(), code.end()); -- 2.7.4