[all-commits] [llvm/llvm-project] dcfa78: Extend InvokeInst !prof branch_weights metadata to...

Yevgeny Rouban via All-commits all-commits at lists.llvm.org
Thu Jun 4 01:38:34 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: dcfa78a4ccec9772d9ff7fea536f81717cf30b24
      https://github.com/llvm/llvm-project/commit/dcfa78a4ccec9772d9ff7fea536f81717cf30b24
  Author: Yevgeny Rouban <yrouban at azul.com>
  Date:   2020-06-04 (Thu, 04 Jun 2020)

  Changed paths:
    M llvm/docs/BranchWeightMetadata.rst
    M llvm/lib/Analysis/BranchProbabilityInfo.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    M llvm/test/Analysis/BranchProbabilityInfo/basic.ll
    M llvm/test/Transforms/Inline/inline-hot-callsite.ll

  Log Message:
  -----------
  Extend InvokeInst !prof branch_weights metadata to unwind branches

Allow InvokeInst to have the second optional prof branch weight for
its unwind branch. InvokeInst is a terminator with two successors.
It might have its unwind branch taken many times. If so
the BranchProbabilityInfo unwind branch heuristic can be inaccurate.
This patch allows a higher accuracy calculated with both branch
weights set.

Changes:
 - A new section about InvokeInst is added to
   the BranchWeightMetadata page. It states the old information that
   missed in the doc and adds new about the second branch weight.
 - Verifier is changed to allow either 1 or 2 branch weights
   for InvokeInst.
 - A new test is written for BranchProbabilityInfo to demonstrate
   the main improvement of the simple fix in calcMetadataWeights().
 - Several new testcases are created for Inliner. Those check that
    both weights are accounted for invoke instruction weight
    calculation.
 - PGOUseFunc::setBranchWeights() is fixed to be applicable to
   InvokeInst.

Reviewers: davidxl, reames, xur, yamauchi
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80618




More information about the All-commits mailing list