[all-commits] [llvm/llvm-project] 7b85e7: [PGO] Consider parent context when weighing branch...

Anton Bikineev via All-commits all-commits at lists.llvm.org
Sat Oct 8 14:49:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b85e765000df36fcc6a5191dec9a28f444245ba
      https://github.com/llvm/llvm-project/commit/7b85e765000df36fcc6a5191dec9a28f444245ba
  Author: Anton Bikineev <bikineev at chromium.org>
  Date:   2022-10-08 (Sat, 08 Oct 2022)

  Changed paths:
    M clang/lib/CodeGen/CGStmt.cpp
    A clang/test/Profile/Inputs/cxx-never-executed-branch.proftext
    A clang/test/Profile/cxx-never-executed-branch.cpp

  Log Message:
  -----------
  [PGO] Consider parent context when weighing branches with likelyhood.

Generally, with PGO enabled the C++20 likelyhood attributes shall be
dropped assuming the profile has a good coverage. However, currently
this is not the case for the following code:

 if (always_false()) [[likely]] {
   ...
 }

The patch fixes this and drops the attribute, if the parent context was
executed in the profile. The patch still preserves the attribute, if the
parent context was not executed, e.g. to support the cases when the
profile has insufficient coverage.

Differential Revision: https://reviews.llvm.org/D134456




More information about the All-commits mailing list