summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-03-15 23:07:41 +0000
committerVitaly Buka <vitalybuka@google.com>2017-03-15 23:07:41 +0000
commitca6ecd213aa1a6af6a2315c259f7a092802e2236 (patch)
tree506e95cc177966d34e0b40f45e3215fd427c2735 /llvm/lib/Transforms/Instrumentation
parentde85ad895d943e4fdd6e4384b26ce0e489e37ec9 (diff)
downloadbcm5719-llvm-ca6ecd213aa1a6af6a2315c259f7a092802e2236.tar.gz
bcm5719-llvm-ca6ecd213aa1a6af6a2315c259f7a092802e2236.zip
Revert "Revert "[PGO] Minor cleanup for count instruction in SelectInstVisitor.""
Previously reverted wrong revision. This reverts commit r297910. llvm-svn: 297911
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
-rw-r--r--llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 258b77c8add..d9c25f2e981 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -205,6 +205,7 @@ struct SelectInstVisitor : public InstVisitor<SelectInstVisitor> {
SelectInstVisitor(Function &Func) : F(Func) {}
void countSelects(Function &Func) {
+ NSIs = 0;
Mode = VM_counting;
visit(Func);
}
@@ -234,6 +235,8 @@ struct SelectInstVisitor : public InstVisitor<SelectInstVisitor> {
void annotateOneSelectInst(SelectInst &SI);
// Visit \p SI instruction and perform tasks according to visit mode.
void visitSelectInst(SelectInst &SI);
+ // Return the number of select instructions. This needs be called after
+ // countSelects().
unsigned getNumOfSelectInsts() const { return NSIs; }
};
@@ -1104,9 +1107,9 @@ void SelectInstVisitor::visitSelectInst(SelectInst &SI) {
if (SI.getCondition()->getType()->isVectorTy())
return;
- NSIs++;
switch (Mode) {
case VM_counting:
+ NSIs++;
return;
case VM_instrument:
instrumentOneSelectInst(SI);
OpenPOWER on IntegriCloud