OSDN Git Service

Revert "[PGO] Minor cleanup for count instruction in SelectInstVisitor."
authorVitaly Buka <vitalybuka@google.com>
Wed, 15 Mar 2017 23:06:22 +0000 (23:06 +0000)
committerVitaly Buka <vitalybuka@google.com>
Wed, 15 Mar 2017 23:06:22 +0000 (23:06 +0000)
Fails LLVMFuzzer.LLVMFuzzer.value-profile-strncmp.test

This reverts commit r297892.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297910 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/PGOInstrumentation.cpp

index d9c25f2..258b77c 100644 (file)
@@ -205,7 +205,6 @@ struct SelectInstVisitor : public InstVisitor<SelectInstVisitor> {
   SelectInstVisitor(Function &Func) : F(Func) {}
 
   void countSelects(Function &Func) {
-    NSIs = 0;
     Mode = VM_counting;
     visit(Func);
   }
@@ -235,8 +234,6 @@ 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; }
 };
 
@@ -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);