diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index d9c25f2e9815c7d276848fe38f4b92444a470d74..258b77c8addb199afa54d125c1e7328d0be3a799 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -205,7 +205,6 @@ struct SelectInstVisitor : public InstVisitor { SelectInstVisitor(Function &Func) : F(Func) {} void countSelects(Function &Func) { - NSIs = 0; Mode = VM_counting; visit(Func); } @@ -235,8 +234,6 @@ struct SelectInstVisitor : public InstVisitor { 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; } }; @@ -1107,9 +1104,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);