[PATCH] D99550: keeping prof metadata for IndirectBrInst
Sergey Pupyrev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 15:49:48 PDT 2021
spupyrev created this revision.
Herald added subscribers: dexonsmith, wenlei, hiraditya.
spupyrev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently prof metadata with branch counts is added only for BranchInst and SwitchInst, but not for IndirectBrInst. As a result, BPI/BFI make incorrect inferences for indirect branches, which can be very hot (e.g., Cinder).
This diff adds metadata for IndirectBrInst, in addition to BranchInst and SwitchInst.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99550
Files:
llvm/lib/IR/Metadata.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1472,7 +1472,8 @@
Instruction *TI = BB->getTerminator();
if (TI->getNumSuccessors() == 1)
continue;
- if (!isa<BranchInst>(TI) && !isa<SwitchInst>(TI))
+ if (!isa<BranchInst>(TI) && !isa<SwitchInst>(TI) &&
+ !isa<IndirectBrInst>(TI))
continue;
DebugLoc BranchLoc = TI->getDebugLoc();
Index: llvm/lib/IR/Metadata.cpp
===================================================================
--- llvm/lib/IR/Metadata.cpp
+++ llvm/lib/IR/Metadata.cpp
@@ -1417,6 +1417,7 @@
getOpcode() == Instruction::Select ||
getOpcode() == Instruction::Call ||
getOpcode() == Instruction::Invoke ||
+ getOpcode() == Instruction::IndirectBr ||
getOpcode() == Instruction::Switch) &&
"Looking for branch weights on something besides branch");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99550.334006.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/2074f73a/attachment.bin>
More information about the llvm-commits
mailing list