[libcxx-commits] [libcxx] [libc++] Add code size benchmarks (PR #226152)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 24 07:18:04 PDT 2026


================
@@ -367,6 +368,10 @@ def execute(self, test, litConfig):
                 parse_results = os.path.join(LIBCXX_UTILS, 'parse-google-benchmark-results')
                 steps += [f"{parse_results} %{{temp}}/benchmark-result.json --output-format=lnt > %{{temp}}/results.lnt"]
             return self._executeShTest(test, litConfig, steps)
+        elif filename.endswith(".codesize.cpp"):
+            steps = ["%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -c -ffunction-sections -o %t.o",
+                     f"%dbg(EXECUTED AS) llvm-objdump -tr %t.o | {os.path.join(LIBCXX_UTILS, "bench-codesize")} | llvm-cxxfilt"]
----------------
ldionne wrote:

I don't think we are guaranteed to have `llvm-objdump` available (or `llvm-cxxfilt`). We would need to detect them, which we can do the same we do for `FileCheck` and `split-file`: https://github.com/llvm/llvm-project/blob/053331c2c9f47fb0795c19f33c128ab82205b4cd/libcxx/utils/libcxx/test/features/misc.py#L321

Long term we need to enforce that these tools are available by installing them when we configure the test suite.

Also, is this available in the CI images?

https://github.com/llvm/llvm-project/pull/226152


More information about the libcxx-commits mailing list