[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:05 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"]
+ return self._executeShTest(test, litConfig, steps)
elif re.search('[.]gen[.][^.]+$', filename): # This only happens when a generator test is not supported
----------------
ldionne wrote:
We should also produce a `.lnt` file which associates each codesize benchmark (i.e. each function marked with `CODESIZE_BM`) to the total size for that function. No breakdown of subfunctions since that format isn't suited to that. That way, we'd get the ability to diff codesize using the same tooling we currently use for execution time.
https://github.com/llvm/llvm-project/pull/226152
More information about the libcxx-commits
mailing list