summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2017-08-23 21:36:02 +0000
committerRong Xu <xur@google.com>2017-08-23 21:36:02 +0000
commit15848e597710e1d62ee4165495871861ac923aef (patch)
tree2b6736345e442675bbd9620b90495826a6970c18 /llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
parent8040a215c901f28cd29ed516254607532a61b06b (diff)
downloadbcm5719-llvm-15848e597710e1d62ee4165495871861ac923aef.tar.gz
bcm5719-llvm-15848e597710e1d62ee4165495871861ac923aef.zip
[PGO] Set edge weights for indirectbr instruction with profile counts
Current PGO only annotates the edge weight for branch and switch instructions with profile counts. We should also annotate the indirectbr instruction as all the information is there. This patch enables the annotating for indirectbr instructions. Also uses this annotation in branch probability analysis. Differential Revision: https://reviews.llvm.org/D37074 llvm-svn: 311604
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index ef955f17bfa..7b8e05b2ed2 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1094,7 +1094,8 @@ void PGOUseFunc::setBranchWeights() {
TerminatorInst *TI = BB.getTerminator();
if (TI->getNumSuccessors() < 2)
continue;
- if (!isa<BranchInst>(TI) && !isa<SwitchInst>(TI))
+ if (!(isa<BranchInst>(TI) || isa<SwitchInst>(TI) ||
+ isa<IndirectBrInst>(TI)))
continue;
if (getBBInfo(&BB).CountValue == 0)
continue;
OpenPOWER on IntegriCloud