[PATCH] D80618: Extend InvokeInst !prof branch_weights metadata to unwind branches
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 03:12:18 PDT 2020
yrouban created this revision.
yrouban added reviewers: chandlerc, tejohnson, davidxl, ebrevnov, skatkov, rnk.
Herald added subscribers: kuter, hiraditya.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
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.
- The method //Instruction::setProfWeight()// is removed as it was used only to copy prof metadata from one CallBase to another. This way prof VP (value profile) data converted to single prof branch_weights entry. Introduced //Instruction::copyProfWeights()// that makes exact copy.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80618
Files:
llvm/docs/BranchWeightMetadata.rst
llvm/include/llvm/IR/Instruction.h
llvm/lib/Analysis/BranchProbabilityInfo.cpp
llvm/lib/IR/Instruction.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Analysis/BranchProbabilityInfo/basic.ll
llvm/test/Transforms/Inline/inline-hot-callsite.ll
llvm/test/Transforms/InstCombine/cast-call-combine-prof.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80618.266466.patch
Type: text/x-patch
Size: 11582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200527/7a95df13/attachment.bin>
More information about the llvm-commits
mailing list