[all-commits] [llvm/llvm-project] 3a807b: [llvm-profdata] Move error handling logic out of n...

William Junda Huang via All-commits all-commits at lists.llvm.org
Mon Sep 25 09:08:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a807b5ac69682331360f81f9d927ed734358fb8
      https://github.com/llvm/llvm-project/commit/3a807b5ac69682331360f81f9d927ed734358fb8
  Author: William Junda Huang <williamjhuang at google.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M llvm/lib/ProfileData/SampleProfReader.cpp

  Log Message:
  -----------
  [llvm-profdata] Move error handling logic out of normal input's code path (#67177)

Based on disassembly and profiling results, it looks like the cost of
std::error_code and llvm::ErrorOr<> are non-trivial, as it involves
virtual function calls that are not optimized in -O3.

This patch moves error handling logic into the conditional branch in
error checking, only generates std::error_code on actual error instead
of the default case to generate sampleprof_error::success.

In the next patch I am looking to change the API to uses a plain old
enum for error checking instead, because based on profiling results
error handling related code accounts for 7-8% of the profile loading
time even if there's no error at all.




More information about the All-commits mailing list